WIP
- Add Coupon, Rules, CouponManager, Adapter as Services - Refactor Coupon to use these services
This commit is contained in:
@@ -137,7 +137,7 @@ class CouponFactory
|
||||
// *
|
||||
// * @return CouponRuleInterface Ready to use Rule or false
|
||||
// */
|
||||
// public function buildCouponRuleFromForm($ruleClassName, $operator, array $values)
|
||||
// public function buildCouponRuleFromForm($ruleServiceId, $operator, array $values)
|
||||
// {
|
||||
// /** @var CouponAdapterInterface $adapter */
|
||||
// $adapter = $this->container->get('thelia.adapter');
|
||||
|
||||
@@ -52,7 +52,7 @@ class CouponManager
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ContainerInterface $container Service container
|
||||
* @param ContainerInterface $container Service container
|
||||
*/
|
||||
function __construct(ContainerInterface $container)
|
||||
{
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Constraint\Rule\CouponRuleInterface;
|
||||
use Thelia\Exception\InvalidRuleException;
|
||||
use Thelia\Constraint\Rule\SerializableRule;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
@@ -45,19 +45,10 @@ class CouponRuleCollection
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $rules Array of CouponRuleInterface
|
||||
*
|
||||
* @throws \Thelia\Exception\InvalidRuleException
|
||||
*/
|
||||
function __construct(array $rules)
|
||||
function __construct()
|
||||
{
|
||||
foreach ($rules as $rule) {
|
||||
if (!$rule instanceof CouponRuleInterface) {
|
||||
throw new InvalidRuleException(get_class());
|
||||
}
|
||||
}
|
||||
$this->rules = $rules;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user