WIP : Refactor contraint/rule becomes conditions (more generic)

This commit is contained in:
gmorel
2013-09-25 14:51:42 +02:00
parent cb389f126c
commit d6172f23cf
75 changed files with 582 additions and 2787 deletions

View File

@@ -68,12 +68,12 @@ class ConditionFactory
*
* @return string A ready to be stored Condition collection
*/
public function serializeCouponRuleCollection(ConditionCollection $collection)
public function serializeConditionCollection(ConditionCollection $collection)
{
if ($collection->isEmpty()) {
/** @var ConditionManagerInterface $conditionNone */
$conditionNone = $this->container->get(
'thelia.constraint.rule.available_for_everyone'
'thelia.condition.match_for_everyone'
);
$collection->add($conditionNone);
}
@@ -83,7 +83,7 @@ class ConditionFactory
/** @var $condition ConditionManagerInterface */
foreach ($conditions as $condition) {
// Remove all rule if the "no condition" condition is found
// if ($condition->getServiceId() == 'thelia.constraint.rule.available_for_everyone') {
// if ($condition->getServiceId() == 'thelia.condition.match_for_everyone') {
// return base64_encode(json_encode(array($condition->getSerializableRule())));
// }
$serializableConditions[] = $condition->getSerializableCondition();
@@ -100,7 +100,7 @@ class ConditionFactory
*
* @return ConditionCollection Conditions ready to be processed
*/
public function unserializeCouponRuleCollection($serializedConditions)
public function unserializeConditionCollection($serializedConditions)
{
$unserializedConditions = json_decode(base64_decode($serializedConditions));

View File

@@ -121,15 +121,15 @@ interface ConditionManagerInterface
*/
public function getValidators();
// /**
// * Populate a Rule from a form admin
// *
// * @param array $operators Rule Operator set by the Admin
// * @param array $values Rule Values set by the Admin
// *
// * @return bool
// */
// public function populateFromForm(array$operators, array $values);
/**
* Populate a Condition from a form admin
*
* @param array $operators Condition Operator set by the Admin
* @param array $values Condition Values set by the Admin
*
* @return bool
*/
public function populateFromForm(array$operators, array $values);
/**

View File

@@ -40,7 +40,7 @@ use Thelia\Condition\ConditionManagerAbstract;
class MatchForEveryoneManager extends ConditionManagerAbstract
{
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.constraint.rule.available_for_everyone';
protected $serviceId = 'thelia.condition.match_for_everyone';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = array();

View File

@@ -51,7 +51,7 @@ class MatchForTotalAmountManager extends ConditionManagerAbstract
CONST INPUT2 = 'currency';
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.constraint.rule.available_for_total_amount';
protected $serviceId = 'thelia.condition.match_for_total_amount';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = array(

View File

@@ -46,7 +46,7 @@ class MatchForXArticlesManager extends ConditionManagerAbstract
CONST INPUT1 = 'quantity';
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.constraint.rule.available_for_x_articles';
protected $serviceId = 'thelia.condition.match_for_x_articles';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = array(