WIP : Coupon : Fix condition edition
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Condition;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Coupon\ConditionCollection;
|
||||
use Thelia\Coupon\Type\CouponInterface;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Condition is created or updated
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class ConditionCreateOrUpdateEvent extends ActionEvent
|
||||
{
|
||||
/** @var ConditionCollection Array of ConditionManagerInterface */
|
||||
protected $conditions = null;
|
||||
|
||||
/** @var CouponInterface Coupon model associated with this conditions */
|
||||
protected $couponModel = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ConditionCollection $conditions Array of ConditionManagerInterface
|
||||
*/
|
||||
public function __construct(ConditionCollection $conditions)
|
||||
{
|
||||
$this->conditions = $conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Conditions
|
||||
*
|
||||
* @return null|ConditionCollection Array of ConditionManagerInterface
|
||||
*/
|
||||
public function getConditions()
|
||||
{
|
||||
return $this->conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Conditions
|
||||
*
|
||||
* @param ConditionCollection $conditions Array of ConditionManagerInterface
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConditions(ConditionCollection $conditions)
|
||||
{
|
||||
$this->conditions = $conditions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Coupon Model associated to this condition
|
||||
*
|
||||
* @param CouponInterface $couponModel Coupon Model
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCouponModel($couponModel)
|
||||
{
|
||||
$this->couponModel = $couponModel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon Model associated to this condition
|
||||
*
|
||||
* @return null|CouponInterface
|
||||
*/
|
||||
public function getCouponModel()
|
||||
{
|
||||
return $this->couponModel;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ use Thelia\Model\Coupon;
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Coupon is created
|
||||
* Occurring when a Coupon is created or updated
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
@@ -76,10 +76,10 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
protected $isAvailableOnSpecialOffers = false;
|
||||
|
||||
/** @var Coupon Coupon model */
|
||||
protected $coupon = null;
|
||||
protected $couponModel = null;
|
||||
|
||||
/** @var string Coupon type */
|
||||
protected $type;
|
||||
/** @var string Coupon Service id */
|
||||
protected $serviceId;
|
||||
|
||||
/** @var string Language code ISO (ex: fr_FR) */
|
||||
protected $locale = null;
|
||||
@@ -90,7 +90,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
* @param string $code Coupon Code
|
||||
* @param string $title Coupon title
|
||||
* @param float $amount Amount removed from the Total Checkout
|
||||
* @param string $type Coupon type
|
||||
* @param string $serviceId Coupon Service id
|
||||
* @param string $shortDescription Coupon short description
|
||||
* @param string $description Coupon description
|
||||
* @param bool $isEnabled Enable/Disable
|
||||
@@ -102,7 +102,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
* @param string $locale Coupon Language code ISO (ex: fr_FR)
|
||||
*/
|
||||
public function __construct(
|
||||
$code, $title, $amount, $type, $shortDescription, $description, $isEnabled, \DateTime $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $isRemovingPostage, $maxUsage, $locale
|
||||
$code, $title, $amount, $serviceId, $shortDescription, $description, $isEnabled, \DateTime $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $isRemovingPostage, $maxUsage, $locale
|
||||
)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
@@ -116,7 +116,7 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
$this->maxUsage = $maxUsage;
|
||||
$this->shortDescription = $shortDescription;
|
||||
$this->title = $title;
|
||||
$this->type = $type;
|
||||
$this->serviceId = $serviceId;
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
@@ -234,13 +234,13 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon type (effect)
|
||||
* Get Coupon Service id (Type)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
public function getServiceId()
|
||||
{
|
||||
return $this->type;
|
||||
return $this->serviceId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,13 +256,13 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
/**
|
||||
* Set Coupon Model
|
||||
*
|
||||
* @param \Thelia\Model\Coupon $coupon Coupon Model
|
||||
* @param Coupon $couponModel Coupon Model
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCoupon($coupon)
|
||||
public function setCouponModel(Coupon $couponModel)
|
||||
{
|
||||
$this->coupon = $coupon;
|
||||
$this->couponModel = $couponModel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -272,13 +272,13 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
*
|
||||
* @return \Thelia\Model\Coupon
|
||||
*/
|
||||
public function getCoupon()
|
||||
public function getCouponModel()
|
||||
{
|
||||
return $this->coupon;
|
||||
return $this->couponModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rules
|
||||
* Get Conditions
|
||||
*
|
||||
* @return null|ConditionCollection Array of ConditionManagerInterface
|
||||
*/
|
||||
@@ -288,15 +288,15 @@ class CouponCreateOrUpdateEvent extends ActionEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* set Rules
|
||||
* Set Conditions
|
||||
*
|
||||
* @param ConditionCollection $rules Array of ConditionManagerInterface
|
||||
* @param ConditionCollection $conditions Array of ConditionManagerInterface
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConditions(ConditionCollection $rules)
|
||||
public function setConditions(ConditionCollection $conditions)
|
||||
{
|
||||
$this->conditions = $rules;
|
||||
$this->conditions = $conditions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user