From 0b9e2552ed60cc60938344cf24850ccdd10bbf22 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 4 Sep 2013 08:30:24 +0200 Subject: [PATCH 1/4] modify travis script --- .travis.yml | 1 + core/lib/Thelia/Action/Address.php | 2 ++ .../Core/Event/AddressCreateOrUpdateEvent.php | 34 +++++++++++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ed4aba4a..3ee2064b8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ before_script: - composer install --prefer-dist --dev - sh -c "mysql -u$DB_USER -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS thelia;SET FOREIGN_KEY_CHECKS = 1;'; fi" - php Thelia thelia:install --db_host=localhost --db_username=$DB_USER --db_name=thelia + - php install/faker.php diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index 021927190..892547304 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -63,6 +63,8 @@ class Address extends BaseAction implements EventSubscriberInterface ->setCompany($event->getCompany()) ->save() ; + + $event->setAddress($addressModel); } /** diff --git a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php index 81c836a83..872021429 100644 --- a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php @@ -23,6 +23,7 @@ namespace Thelia\Core\Event; use Symfony\Component\EventDispatcher\Event; +use Thelia\Model\Address; use Thelia\Model\Customer; @@ -103,7 +104,12 @@ class AddressCreateOrUpdateEvent extends Event */ protected $customer; - function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company, Customer $customer) + /** + * @var \Thelia\Model\Address + */ + protected $address; + + function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company) { $this->address1 = $address1; $this->address2 = $address2; @@ -118,7 +124,6 @@ class AddressCreateOrUpdateEvent extends Event $this->phone = $phone; $this->title = $title; $this->zipcode = $zipcode; - $this->customer = $customer; } /** @@ -225,6 +230,14 @@ class AddressCreateOrUpdateEvent extends Event return $this->zipcode; } + /** + * @param \Thelia\Model\Customer $customer + */ + public function setCustomer(Customer $customer) + { + $this->customer = $customer; + } + /** * @return \Thelia\Model\Customer */ @@ -233,4 +246,21 @@ class AddressCreateOrUpdateEvent extends Event return $this->customer; } + /** + * @param \Thelia\Model\Address $address + */ + public function setAddress(Address $address) + { + $this->address = $address; + } + + /** + * @return \Thelia\Model\Address + */ + public function getAddress() + { + return $this->address; + } + + } \ No newline at end of file From dad1a1c61217328c44e59bcc2422d3e2f3b49b48 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 4 Sep 2013 10:09:51 +0200 Subject: [PATCH 2/4] add update address action and create tests --- core/lib/Thelia/Action/Address.php | 11 ++ .../Core/Event/AddressCreateOrUpdateEvent.php | 1 + core/lib/Thelia/Tests/Action/AddressTest.php | 145 ++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 core/lib/Thelia/Tests/Action/AddressTest.php diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index 892547304..e28a98370 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -43,11 +43,22 @@ class Address extends BaseAction implements EventSubscriberInterface $this->createOrUpdate($address, $event); } + public function update(AddressCreateOrUpdateEvent $event) + { + $addressModel = $event->getAddress(); + + $this->createOrUpdate($addressModel, $event); + } + protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event) { $addressModel->setDispatcher($this->getDispatcher()); + if ($addressModel->isNew()) { + $addressModel->setLabel($event->getLabel()); + } + $addressModel ->setTitleId($event->getTitle()) ->setFirstname($event->getFirstname()) diff --git a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php index 872021429..1eee2acc8 100644 --- a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php @@ -252,6 +252,7 @@ class AddressCreateOrUpdateEvent extends Event public function setAddress(Address $address) { $this->address = $address; + $this->setCustomer($address->getCustomer()); } /** diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php new file mode 100644 index 000000000..68fc97923 --- /dev/null +++ b/core/lib/Thelia/Tests/Action/AddressTest.php @@ -0,0 +1,145 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action; +use Thelia\Action\Address; +use Thelia\Core\Event\AddressCreateOrUpdateEvent; +use Thelia\Model\Base\CustomerQuery; + + +/** + * + * test address eventListener + * + * Class AddressTest + * @package Thelia\Tests\Action + * @author Manuel Raynaud + */ +class AddressTest extends \PHPUnit_Framework_TestCase +{ + + public function getContainer() + { + $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); + + $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); + + $container->set("event_dispatcher", $dispatcher); + + return $container; + } + + public function testCreatedAddress() + { + $customer = CustomerQuery::create()->findOne(); + + $AddressCreateOrUpdateEvent = new AddressCreateOrUpdateEvent( + "test address", + 1, + "Thelia", + "Thelia", + "5 rue rochon", + "", + "", + "63000", + "clermont-ferrand", + 64, + "0102030405", + "", + "" + ); + $AddressCreateOrUpdateEvent->setCustomer($customer); + + $actionAddress = new Address($this->getContainer()); + $actionAddress->create($AddressCreateOrUpdateEvent); + + $createdAddress = $AddressCreateOrUpdateEvent->getAddress(); + + $this->assertInstanceOf("Thelia\Model\Address", $createdAddress); + $this->assertFalse($createdAddress->isNew()); + $this->assertSame($customer, $createdAddress->getCustomer()); + + $this->assertEquals($AddressCreateOrUpdateEvent->getLabel(), $createdAddress->getLabel()); + $this->assertEquals($AddressCreateOrUpdateEvent->getTitle(), $createdAddress->getTitleId()); + $this->assertEquals($AddressCreateOrUpdateEvent->getFirstname(), $createdAddress->getFirstname()); + $this->assertEquals($AddressCreateOrUpdateEvent->getLastname(), $createdAddress->getLastname()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress1(), $createdAddress->getAddress1()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress2(), $createdAddress->getAddress2()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress3(), $createdAddress->getAddress3()); + $this->assertEquals($AddressCreateOrUpdateEvent->getZipcode(), $createdAddress->getZipcode()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCity(), $createdAddress->getCity()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCountry(), $createdAddress->getCountryId()); + $this->assertEquals($AddressCreateOrUpdateEvent->getPhone(), $createdAddress->getPhone()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCellphone(), $createdAddress->getCellphone()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCompany(), $createdAddress->getCompany()); + } + + public function testUpdatedAddress() + { + + $customer = CustomerQuery::create()->findOne(); + $address = $customer->getAddresses()->getFirst(); + + $addressEvent = new AddressCreateOrUpdateEvent( + "", + 1, + "Thelia modif", + "Thelia modif", + "cour des étoiles", + "rue des miracles", + "", + "63000", + "clermont-ferrand", + 64, + "0102030405", + "", + "" + ); + $addressEvent->setAddress($address); + + $actionAddress = new Address($this->getContainer()); + $actionAddress->update($addressEvent); + + + $updatedAddress = $addressEvent->getAddress(); + $this->assertInstanceOf("Thelia\Model\Address", $updatedAddress); + $this->assertFalse($updatedAddress->isNew()); + $this->assertSame($customer, $updatedAddress->getCustomer()); + + $this->assertEquals($address->getLabel(), $updatedAddress->getLabel()); + $this->assertEquals($addressEvent->getTitle(), $updatedAddress->getTitleId()); + $this->assertEquals($addressEvent->getFirstname(), $updatedAddress->getFirstname()); + $this->assertEquals($addressEvent->getLastname(), $updatedAddress->getLastname()); + $this->assertEquals($addressEvent->getAddress1(), $updatedAddress->getAddress1()); + $this->assertEquals($addressEvent->getAddress2(), $updatedAddress->getAddress2()); + $this->assertEquals($addressEvent->getAddress3(), $updatedAddress->getAddress3()); + $this->assertEquals($addressEvent->getZipcode(), $updatedAddress->getZipcode()); + $this->assertEquals($addressEvent->getCity(), $updatedAddress->getCity()); + $this->assertEquals($addressEvent->getCountry(), $updatedAddress->getCountryId()); + $this->assertEquals($addressEvent->getPhone(), $updatedAddress->getPhone()); + $this->assertEquals($addressEvent->getCellphone(), $updatedAddress->getCellphone()); + $this->assertEquals($addressEvent->getCompany(), $updatedAddress->getCompany()); + + } + +} \ No newline at end of file From b9a7030d90bda91fbaeb49566ca65bd75055b275 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 4 Sep 2013 10:37:25 +0200 Subject: [PATCH 3/4] choose UPDATE word for name actions --- core/lib/Thelia/Core/Event/TheliaEvents.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index e32be723f..b77636eb4 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -64,7 +64,7 @@ final class TheliaEvents /** * sent on customer account update */ - const CUSTOMER_UPDATEACCOUNT = "action.modifyCustomer"; + const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer"; /** * Sent before the logout of the administrator. @@ -88,16 +88,21 @@ final class TheliaEvents /** * Sent once the customer change form has been successfully validated, and before customer update in the database. */ - const BEFORE_CHANGECUSTOMER = "action.before_changecustomer"; + const BEFORE_CHANGECUSTOMER = "action.before_updateCustomer"; /** * Sent just after a successful update of a customer in the database. */ - const AFTER_CHANGECUSTOMER = "action.after_changecustomer"; + const AFTER_CHANGECUSTOMER = "action.after_updateCustomer"; /** * sent for address creation */ - const ADDRESS_CREATE = "action.addressCreate"; + const ADDRESS_CREATE = "action.createAddress"; + + /** + * sent for address creation + */ + const ADDRESS_UPDATE = "action.updateAddress"; /** * Sent once the category creation form has been successfully validated, and before category insertion in the database. From d23190303cf4c53fa6e17fabb116e2e74807bcbf Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 4 Sep 2013 10:48:59 +0200 Subject: [PATCH 4/4] refactor name for updating actions --- core/lib/Thelia/Action/Address.php | 3 +- core/lib/Thelia/Action/Category.php | 4 +-- core/lib/Thelia/Action/Config.php | 2 +- core/lib/Thelia/Action/Currency.php | 2 +- core/lib/Thelia/Action/Message.php | 2 +- .../Controller/Admin/ConfigController.php | 2 +- .../Controller/Admin/CurrencyController.php | 2 +- .../Controller/Admin/MessageController.php | 2 +- .../Controller/Front/CartController.php | 2 +- core/lib/Thelia/Core/Event/TheliaEvents.php | 28 +++++++++---------- core/lib/Thelia/Model/CartItem.php | 2 +- core/lib/Thelia/Model/Category.php | 4 +-- core/lib/Thelia/Model/Config.php | 4 +-- core/lib/Thelia/Model/Currency.php | 4 +-- core/lib/Thelia/Model/Message.php | 4 +-- .../Thelia.Core.Event.TheliaEvents.html | 18 ++++++------ .../api/files/Action/Category.php.txt | 2 +- .../Controller/Front/CartController.php.txt | 2 +- .../api/files/Core/Event/TheliaEvents.php.txt | 6 ++-- .../api/files/Model/CartItem.php.txt | 2 +- 20 files changed, 49 insertions(+), 48 deletions(-) diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index e28a98370..32ec24c05 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -101,7 +101,8 @@ class Address extends BaseAction implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - TheliaEvents::ADDRESS_CREATE => array("create", 128) + TheliaEvents::ADDRESS_CREATE => array("create", 128), + TheliaEvents::ADDRESS_UPDATE => array("update", 128) ); } } \ No newline at end of file diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php index 59604bab9..28ca2fc9e 100755 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -53,7 +53,7 @@ class Category extends BaseAction implements EventSubscriberInterface ); } - public function modify(CategoryChangeEvent $event) + public function update(CategoryChangeEvent $event) { } @@ -242,7 +242,7 @@ class Category extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::CATEGORY_CREATE => array("create", 128), - TheliaEvents::CATEGORY_MODIFY => array("modify", 128), + TheliaEvents::CATEGORY_UPDATE => array("update", 128), TheliaEvents::CATEGORY_DELETE => array("delete", 128), TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), diff --git a/core/lib/Thelia/Action/Config.php b/core/lib/Thelia/Action/Config.php index fa683f1d4..c7b016c63 100644 --- a/core/lib/Thelia/Action/Config.php +++ b/core/lib/Thelia/Action/Config.php @@ -148,7 +148,7 @@ class Config extends BaseAction implements EventSubscriberInterface return array( TheliaEvents::CONFIG_CREATE => array("create", 128), TheliaEvents::CONFIG_SETVALUE => array("setValue", 128), - TheliaEvents::CONFIG_MODIFY => array("modify", 128), + TheliaEvents::CONFIG_UPDATE => array("modify", 128), TheliaEvents::CONFIG_DELETE => array("delete", 128), ); } diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php index 4e3bb45d4..6b4ec626f 100644 --- a/core/lib/Thelia/Action/Currency.php +++ b/core/lib/Thelia/Action/Currency.php @@ -113,7 +113,7 @@ class Currency extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::CURRENCY_CREATE => array("create", 128), - TheliaEvents::CURRENCY_MODIFY => array("modify", 128), + TheliaEvents::CURRENCY_UPDATE => array("modify", 128), TheliaEvents::CURRENCY_DELETE => array("delete", 128), ); } diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php index dd50a5652..f2335bd82 100644 --- a/core/lib/Thelia/Action/Message.php +++ b/core/lib/Thelia/Action/Message.php @@ -118,7 +118,7 @@ class Message extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::MESSAGE_CREATE => array("create", 128), - TheliaEvents::MESSAGE_MODIFY => array("modify", 128), + TheliaEvents::MESSAGE_UPDATE => array("modify", 128), TheliaEvents::MESSAGE_DELETE => array("delete", 128), ); } diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index 8f761ed7e..171bfcb95 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -210,7 +210,7 @@ class ConfigController extends BaseAdminController ->setPostscriptum($data['postscriptum']) ; - $this->dispatch(TheliaEvents::CONFIG_MODIFY, $changeEvent); + $this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent); // Log config modification $changedObject = $changeEvent->getConfig(); diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index 69cc60117..e920d48f2 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -218,7 +218,7 @@ class CurrencyController extends BaseAdminController ->setRate($data['rate']) ; - $this->dispatch(TheliaEvents::CURRENCY_MODIFY, $changeEvent); + $this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent); // Log currency modification $changedObject = $changeEvent->getCurrency(); diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index 5a53fd28a..18eff44fa 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -204,7 +204,7 @@ class MessageController extends BaseAdminController ->setTextMessage($data['text_message']) ; - $this->dispatch(TheliaEvents::MESSAGE_MODIFY, $changeEvent); + $this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent); // Log message modification $changedObject = $changeEvent->getMessage(); diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php index 8f2cdd036..c3d928a15 100755 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -74,7 +74,7 @@ class CartController extends BaseFrontController $cartEvent->setQuantity($this->getRequest()->get("quantity")); try { - $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); + $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent); $this->redirectSuccess(); } catch(PropelException $e) { diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index b77636eb4..deb7b9619 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -113,7 +113,7 @@ final class TheliaEvents * Create, change or delete a category */ const CATEGORY_CREATE = "action.createCategory"; - const CATEGORY_MODIFY = "action.modifyCategory"; + const CATEGORY_UPDATE = "action.updateCategory"; const CATEGORY_DELETE = "action.deleteCategory"; /** @@ -143,12 +143,12 @@ final class TheliaEvents /** * Sent just before a successful change of a category in the database. */ - const BEFORE_CHANGECATEGORY = "action.before_changecategory"; + const BEFORE_UPDATECATEGORY = "action.before_updateCategory"; /** * Sent just after a successful change of a category in the database. */ - const AFTER_CHANGECATEGORY = "action.after_changecategory"; + const AFTER_UPDATECATEGORY = "action.after_updateCategory"; /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart @@ -163,7 +163,7 @@ final class TheliaEvents /** * sent when a cart item is modify */ - const AFTER_CARTCHANGEITEM = "cart.modifyItem"; + const AFTER_CARTUPDATEITEM = "cart.updateItem"; /** * sent for addArticle action @@ -173,7 +173,7 @@ final class TheliaEvents /** * sent on modify article action */ - const CART_CHANGEITEM = "action.changeArticle"; + const CART_UPDATEITEM = "action.updateArticle"; const CART_DELETEITEM = "action.deleteArticle"; @@ -191,14 +191,14 @@ final class TheliaEvents const CONFIG_CREATE = "action.createConfig"; const CONFIG_SETVALUE = "action.setConfigValue"; - const CONFIG_MODIFY = "action.changeConfig"; + const CONFIG_UPDATE = "action.updateConfig"; const CONFIG_DELETE = "action.deleteConfig"; const BEFORE_CREATECONFIG = "action.before_createConfig"; const AFTER_CREATECONFIG = "action.after_createConfig"; - const BEFORE_CHANGECONFIG = "action.before_changeConfig"; - const AFTER_CHANGECONFIG = "action.after_changeConfig"; + const BEFORE_UPDATECONFIG = "action.before_updateConfig"; + const AFTER_UPDATECONFIG = "action.after_updateConfig"; const BEFORE_DELETECONFIG = "action.before_deleteConfig"; const AFTER_DELETECONFIG = "action.after_deleteConfig"; @@ -206,14 +206,14 @@ final class TheliaEvents // -- Messages management --------------------------------------------- const MESSAGE_CREATE = "action.createMessage"; - const MESSAGE_MODIFY = "action.changeMessage"; + const MESSAGE_UPDATE = "action.updateMessage"; const MESSAGE_DELETE = "action.deleteMessage"; const BEFORE_CREATEMESSAGE = "action.before_createMessage"; const AFTER_CREATEMESSAGE = "action.after_createMessage"; - const BEFORE_CHANGEMESSAGE = "action.before_changeMessage"; - const AFTER_CHANGEMESSAGE = "action.after_changeMessage"; + const BEFORE_UPDATEMESSAGE = "action.before_updateMessage"; + const AFTER_UPDATEMESSAGE = "action.after_updateMessage"; const BEFORE_DELETEMESSAGE = "action.before_deleteMessage"; const AFTER_DELETEMESSAGE = "action.after_deleteMessage"; @@ -221,14 +221,14 @@ final class TheliaEvents // -- Currencies management --------------------------------------------- const CURRENCY_CREATE = "action.createCurrency"; - const CURRENCY_MODIFY = "action.changeCurrency"; + const CURRENCY_UPDATE = "action.updateCurrency"; const CURRENCY_DELETE = "action.deleteCurrency"; const BEFORE_CREATECURRENCY = "action.before_createCurrency"; const AFTER_CREATECURRENCY = "action.after_createCurrency"; - const BEFORE_CHANGECURRENCY = "action.before_changeCurrency"; - const AFTER_CHANGECURRENCY = "action.after_changeCurrency"; + const BEFORE_UPDATECURRENCY = "action.before_updateCurrency"; + const AFTER_UPDATECURRENCY = "action.after_updateCurrency"; const BEFORE_DELETECURRENCY = "action.before_deleteCurrency"; const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; diff --git a/core/lib/Thelia/Model/CartItem.php b/core/lib/Thelia/Model/CartItem.php index fbfbee32c..5ef6048a5 100755 --- a/core/lib/Thelia/Model/CartItem.php +++ b/core/lib/Thelia/Model/CartItem.php @@ -32,7 +32,7 @@ class CartItem extends BaseCartItem if ($this->dispatcher) { $cartEvent = new CartEvent($this->getCart()); - $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); + $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent); } } diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index ae999ccc8..5564112c9 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -95,14 +95,14 @@ class Category extends BaseCategory public function preUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECATEGORY, new CategoryEvent($this)); + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY, new CategoryEvent($this)); return true; } public function postUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECATEGORY, new CategoryEvent($this)); + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECATEGORY, new CategoryEvent($this)); } public function preDelete(ConnectionInterface $con = null) diff --git a/core/lib/Thelia/Model/Config.php b/core/lib/Thelia/Model/Config.php index 70880151c..a3289af27 100755 --- a/core/lib/Thelia/Model/Config.php +++ b/core/lib/Thelia/Model/Config.php @@ -55,7 +55,7 @@ class Config extends BaseConfig { */ public function preUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECONFIG, new ConfigEvent($this)); + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECONFIG, new ConfigEvent($this)); return true; } @@ -65,7 +65,7 @@ class Config extends BaseConfig { */ public function postUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECONFIG, new ConfigEvent($this)); + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this)); } /** diff --git a/core/lib/Thelia/Model/Currency.php b/core/lib/Thelia/Model/Currency.php index f2f1175c6..fc1c86b67 100755 --- a/core/lib/Thelia/Model/Currency.php +++ b/core/lib/Thelia/Model/Currency.php @@ -34,7 +34,7 @@ class Currency extends BaseCurrency { */ public function preUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECURRENCY, new CurrencyEvent($this)); + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECURRENCY, new CurrencyEvent($this)); return true; } @@ -44,7 +44,7 @@ class Currency extends BaseCurrency { */ public function postUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECURRENCY, new CurrencyEvent($this)); + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECURRENCY, new CurrencyEvent($this)); } /** diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php index 97fb45469..aa6481ab8 100755 --- a/core/lib/Thelia/Model/Message.php +++ b/core/lib/Thelia/Model/Message.php @@ -34,7 +34,7 @@ class Message extends BaseMessage { */ public function preUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGEMESSAGE, new MessageEvent($this)); + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEMESSAGE, new MessageEvent($this)); return true; } @@ -44,7 +44,7 @@ class Message extends BaseMessage { */ public function postUpdate(ConnectionInterface $con = null) { - $this->dispatchEvent(TheliaEvents::AFTER_CHANGEMESSAGE, new MessageEvent($this)); + $this->dispatchEvent(TheliaEvents::AFTER_UPDATEMESSAGE, new MessageEvent($this)); } /** diff --git a/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html b/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html index 3491e4264..fe9f532a1 100755 --- a/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html +++ b/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html @@ -1637,12 +1637,12 @@ AFTER_CREATECATEGORY
BEFORE_DELETECATEGORY
AFTER_DELETECATEGORY
- AFTER_CHANGECATEGORY
+ AFTER_UPDATECATEGORY
CART_DUPLICATE
AFTER_CARTADDITEM
- AFTER_CARTCHANGEITEM
+ AFTER_CARTUPDATEITEM
CART_ADDITEM
- CART_CHANGEITEM
+ CART_UPDATEITEM
CART_DELETEITEM
@@ -2023,8 +2023,8 @@
-

AFTER_CHANGECATEGORY

-
AFTER_CHANGECATEGORY
+

AFTER_UPDATECATEGORY

+
AFTER_UPDATECATEGORY

Sent just after a successful change of a category in the database.

@@ -2089,8 +2089,8 @@
-

AFTER_CARTCHANGEITEM

-
AFTER_CARTCHANGEITEM
+

AFTER_CARTUPDATEITEM

+
AFTER_CARTUPDATEITEM

sent when a cart item is modify

@@ -2133,8 +2133,8 @@
-

CART_CHANGEITEM

-
CART_CHANGEITEM
+

CART_UPDATEITEM

+
CART_UPDATEITEM

sent on modify article action

diff --git a/documentation/api/files/Action/Category.php.txt b/documentation/api/files/Action/Category.php.txt index a47d51c75..b62357b08 100755 --- a/documentation/api/files/Action/Category.php.txt +++ b/documentation/api/files/Action/Category.php.txt @@ -227,7 +227,7 @@ class Category extends BaseAction implements EventSubscriberInterface $categoryEvent = new CategoryEvent($category); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $categoryEvent); + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECATEGORY, $categoryEvent); } } diff --git a/documentation/api/files/Controller/Front/CartController.php.txt b/documentation/api/files/Controller/Front/CartController.php.txt index c800070e2..de27c7be4 100755 --- a/documentation/api/files/Controller/Front/CartController.php.txt +++ b/documentation/api/files/Controller/Front/CartController.php.txt @@ -74,7 +74,7 @@ class CartController extends BaseFrontController $cartEvent->setQuantity($this->getRequest()->get("quantity")); try { - $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); + $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent); $this->redirectSuccess(); } catch(PropelException $e) { diff --git a/documentation/api/files/Core/Event/TheliaEvents.php.txt b/documentation/api/files/Core/Event/TheliaEvents.php.txt index 7ddc0b786..e06abc3c7 100755 --- a/documentation/api/files/Core/Event/TheliaEvents.php.txt +++ b/documentation/api/files/Core/Event/TheliaEvents.php.txt @@ -106,7 +106,7 @@ final class TheliaEvents /** * Sent just after a successful change of a category in the database. */ - const AFTER_CHANGECATEGORY = "action.after_changecategory"; + const AFTER_UPDATECATEGORY = "action.after_changecategory"; /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart @@ -121,7 +121,7 @@ final class TheliaEvents /** * sent when a cart item is modify */ - const AFTER_CARTCHANGEITEM = "cart.modifyItem"; + const AFTER_CARTUPDATEITEM = "cart.modifyItem"; /** * sent for addArticle action @@ -131,7 +131,7 @@ final class TheliaEvents /** * sent on modify article action */ - const CART_CHANGEITEM = "action.changeArticle"; + const CART_UPDATEITEM = "action.changeArticle"; const CART_DELETEITEM = "action.deleteArticle"; } diff --git a/documentation/api/files/Model/CartItem.php.txt b/documentation/api/files/Model/CartItem.php.txt index a9671b57b..d956fd25d 100755 --- a/documentation/api/files/Model/CartItem.php.txt +++ b/documentation/api/files/Model/CartItem.php.txt @@ -32,7 +32,7 @@ class CartItem extends BaseCartItem if ($this->dispatcher) { $cartEvent = new CartEvent($this->getCart()); - $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); + $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent); } }