From 1105990a41d4e602f95ff0a9df6c429f5cb112a5 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 4 Sep 2013 11:33:24 +0200 Subject: [PATCH] event classes must extends ActionEvent --- .../Thelia/Config/Resources/routing/front.xml | 2 +- .../Core/Event/AddressCreateOrUpdateEvent.php | 2 +- core/lib/Thelia/Core/Event/CartEvent.php | 2 +- .../Event/CustomerCreateOrUpdateEvent.php | 2 +- core/lib/Thelia/Model/Address.php | 58 +++++++++++++++++++ 5 files changed, 62 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index 500fe7427..3d6078f58 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -29,7 +29,7 @@ - + Thelia\Controller\Front\CustomerAddressController::createAction diff --git a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php index 1eee2acc8..d6dd6e3ed 100644 --- a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php @@ -32,7 +32,7 @@ use Thelia\Model\Customer; * @package Thelia\Core\Event * @author Manuel Raynaud */ -class AddressCreateOrUpdateEvent extends Event +class AddressCreateOrUpdateEvent extends ActionEvent { /** * @var string address label diff --git a/core/lib/Thelia/Core/Event/CartEvent.php b/core/lib/Thelia/Core/Event/CartEvent.php index 59e67e2bf..61d58e9d2 100755 --- a/core/lib/Thelia/Core/Event/CartEvent.php +++ b/core/lib/Thelia/Core/Event/CartEvent.php @@ -26,7 +26,7 @@ namespace Thelia\Core\Event; use Symfony\Component\EventDispatcher\Event; use Thelia\Model\Cart; -class CartEvent extends Event +class CartEvent extends ActionEvent { protected $cart; protected $quantity; diff --git a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php index e7cf83b5c..9bee163ae 100755 --- a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php @@ -13,7 +13,7 @@ namespace Thelia\Core\Event; use Symfony\Component\EventDispatcher\Event; use Thelia\Model\Customer; -class CustomerCreateOrUpdateEvent extends Event { +class CustomerCreateOrUpdateEvent extends ActionEvent { //base parameters for creating new customer protected $title; diff --git a/core/lib/Thelia/Model/Address.php b/core/lib/Thelia/Model/Address.php index 58e6285ca..2501d5d1f 100755 --- a/core/lib/Thelia/Model/Address.php +++ b/core/lib/Thelia/Model/Address.php @@ -2,6 +2,7 @@ namespace Thelia\Model; +use Propel\Runtime\Connection\ConnectionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Thelia\Model\Base\Address as BaseAddress; @@ -19,4 +20,61 @@ class Address extends BaseAddress { return $this->dispatcher; } + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + }