Refactor removing Manager notion
This commit is contained in:
@@ -71,7 +71,7 @@ class CouponFactory
|
||||
* @throws \Symfony\Component\Translation\Exception\NotFoundResourceException
|
||||
* @return CouponInterface ready to be processed
|
||||
*/
|
||||
public function buildCouponFromCode($couponCode)
|
||||
public function buildCouponManagerFromCode($couponCode)
|
||||
{
|
||||
/** @var Coupon $couponModel */
|
||||
$couponModel = $this->facade->findOneCouponByCode($couponCode);
|
||||
@@ -86,7 +86,7 @@ class CouponFactory
|
||||
}
|
||||
|
||||
/** @var CouponInterface $couponInterface */
|
||||
$couponInterface = $this->buildCouponInterfaceFromModel($couponModel);
|
||||
$couponInterface = $this->buildCouponManagerFromModel($couponModel);
|
||||
if ($couponInterface->getConditions()->isEmpty()) {
|
||||
throw new InvalidConditionException(
|
||||
get_class($couponInterface)
|
||||
@@ -103,7 +103,7 @@ class CouponFactory
|
||||
*
|
||||
* @return CouponInterface ready to use CouponInterface object instance
|
||||
*/
|
||||
protected function buildCouponInterfaceFromModel(Coupon $model)
|
||||
protected function buildCouponManagerFromModel(Coupon $model)
|
||||
{
|
||||
$isCumulative = ($model->getIsCumulative() == 1 ? true : false);
|
||||
$isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Coupon;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Condition\ConditionManagerInterface;
|
||||
use Thelia\Condition\ConditionInterface;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
@@ -213,9 +213,9 @@ class CouponManager
|
||||
/**
|
||||
* Add an available ConstraintManager (Services)
|
||||
*
|
||||
* @param ConditionManagerInterface $condition ConditionManagerInterface
|
||||
* @param ConditionInterface $condition ConditionInterface
|
||||
*/
|
||||
public function addAvailableCondition(ConditionManagerInterface $condition)
|
||||
public function addAvailableCondition(ConditionInterface $condition)
|
||||
{
|
||||
$this->availableConditions[] = $condition;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
/** @var ConditionOrganizerInterface */
|
||||
protected $organizer = null;
|
||||
|
||||
/** @var ConditionCollection Array of ConditionManagerInterface */
|
||||
/** @var ConditionCollection Array of ConditionInterface */
|
||||
protected $conditions = null;
|
||||
|
||||
/** @var ConditionEvaluator Condition validator */
|
||||
@@ -214,7 +214,7 @@ abstract class CouponAbstract implements CouponInterface
|
||||
* Replace the existing Conditions by those given in parameter
|
||||
* If one Condition is badly implemented, no Condition will be added
|
||||
*
|
||||
* @param ConditionCollection $conditions ConditionManagerInterface to add
|
||||
* @param ConditionCollection $conditions ConditionInterface to add
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\InvalidConditionException
|
||||
|
||||
@@ -140,7 +140,7 @@ interface CouponInterface
|
||||
/**
|
||||
* Return condition to validate the Coupon or not
|
||||
*
|
||||
* @return ConditionCollection A set of ConditionManagerInterface
|
||||
* @return ConditionCollection A set of ConditionInterface
|
||||
*/
|
||||
public function getConditions();
|
||||
|
||||
@@ -148,7 +148,7 @@ interface CouponInterface
|
||||
* Replace the existing Conditions by those given in parameter
|
||||
* If one Condition is badly implemented, no Condition will be added
|
||||
*
|
||||
* @param ConditionCollection $conditions ConditionManagerInterface to add
|
||||
* @param ConditionCollection $conditions ConditionInterface to add
|
||||
*
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\InvalidConditionException
|
||||
|
||||
@@ -37,7 +37,7 @@ use Thelia\Coupon\Type\CouponAbstract;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class RemoveXAmountManager extends CouponAbstract
|
||||
class RemoveXAmount extends CouponAbstract
|
||||
{
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = 'thelia.coupon.type.remove_x_amount';
|
||||
@@ -36,7 +36,7 @@ use Thelia\Exception\MissingFacadeException;
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class RemoveXPercentManager extends CouponAbstract
|
||||
class RemoveXPercent extends CouponAbstract
|
||||
{
|
||||
/** @var string Service Id */
|
||||
protected $serviceId = 'thelia.coupon.type.remove_x_percent';
|
||||
Reference in New Issue
Block a user