WIP
- Update Coupon Controller/Form/Event - create() - Rule serialization/unserialization managed in Model/Coupon now
This commit is contained in:
@@ -22,61 +22,60 @@
|
||||
/**********************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Coupon;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Coupon is created
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class CouponCreateEvent extends ActionEvent
|
||||
{
|
||||
protected $title;
|
||||
protected $parent;
|
||||
protected $locale;
|
||||
protected $created_category;
|
||||
/**
|
||||
* @var Coupon Coupon being created
|
||||
*/
|
||||
protected $createdCoupon;
|
||||
|
||||
public function __construct($title, $parent, $locale)
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Coupon $coupon Coupon being created
|
||||
*/
|
||||
public function __construct(Coupon $coupon)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->parent = $parent;
|
||||
$this->locale = $locale;
|
||||
$this->createdCoupon = $coupon;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
/**
|
||||
* Modify Coupon being created
|
||||
*
|
||||
* @param Coupon $createdCoupon Coupon being created
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreatedCoupon(Coupon $createdCoupon)
|
||||
{
|
||||
return $this->title;
|
||||
$this->createdCoupon = $createdCoupon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
/**
|
||||
* Get Coupon being created
|
||||
*
|
||||
* @return Coupon
|
||||
*/
|
||||
public function getCreatedCoupon()
|
||||
{
|
||||
$this->title = $title;
|
||||
return clone $this->createdCoupon;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
public function getCreatedCategory()
|
||||
{
|
||||
return $this->created_category;
|
||||
}
|
||||
|
||||
public function setCreatedCategory(Category $created_category)
|
||||
{
|
||||
$this->created_category = $created_category;
|
||||
var_dump($this->created_category);
|
||||
}
|
||||
}
|
||||
|
||||
82
core/lib/Thelia/Core/Event/Coupon/CouponEditEvent.php
Normal file
82
core/lib/Thelia/Core/Event/Coupon/CouponEditEvent.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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\Coupon;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Coupon;
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 8/29/13
|
||||
* Time: 3:45 PM
|
||||
*
|
||||
* Occurring when a Coupon is edited
|
||||
*
|
||||
* @package Coupon
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class CouponEditEvent extends ActionEvent
|
||||
{
|
||||
/** @var int Coupon being edited id */
|
||||
protected $couponId;
|
||||
|
||||
/** @var Coupon Coupon being created */
|
||||
protected $editedCoupon;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Coupon $coupon Coupon being edited
|
||||
*/
|
||||
public function __construct(Coupon $coupon)
|
||||
{
|
||||
$this->created_coupon = $coupon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify Coupon being created
|
||||
*
|
||||
* @param Coupon $editedCoupon Coupon being created
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreatedCoupon(Coupon $editedCoupon)
|
||||
{
|
||||
$this->editedCoupon = $editedCoupon;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Coupon being created
|
||||
*
|
||||
* @return Coupon
|
||||
*/
|
||||
public function getCreatedCoupon()
|
||||
{
|
||||
return clone $this->editedCoupon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -177,4 +177,56 @@ final class TheliaEvents
|
||||
* Sent on cimage cache clear request
|
||||
*/
|
||||
const IMAGE_CLEAR_CACHE = "action.clearImageCache";
|
||||
|
||||
|
||||
/**
|
||||
* Sent just before a successful insert of a new Coupon in the database.
|
||||
*/
|
||||
|
||||
const BEFORE_CREATE_COUPON = "action.before_create_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful insert of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_CREATE_COUPON = "action.after_create_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before a successful update of a new Coupon in the database.
|
||||
*/
|
||||
const BEFORE_EDIT_COUPON = "action.before_edit_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful update of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_EDIT_COUPON = "action.after_edit_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before a successful disable of a new Coupon in the database.
|
||||
*/
|
||||
const BEFORE_DISABLE_COUPON = "action.before_disable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful disable of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_DISABLE_COUPON = "action.after_disable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before a successful enable of a new Coupon in the database.
|
||||
*/
|
||||
const BEFORE_ENABLE_COUPON = "action.before_enable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after a successful enable of a new Coupon in the database.
|
||||
*/
|
||||
const AFTER_ENABLE_COUPON = "action.after_enable_coupon";
|
||||
|
||||
/**
|
||||
* Sent just before an attempt to use a Coupon
|
||||
*/
|
||||
const BEFORE_USE_COUPON = "action.before_use_coupon";
|
||||
|
||||
/**
|
||||
* Sent just after an attempt to use a Coupon
|
||||
*/
|
||||
const AFTER_USE_COUPON = "action.after_use_coupon";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user