refactor name for updating actions

This commit is contained in:
Manuel Raynaud
2013-09-04 10:48:59 +02:00
parent b9a7030d90
commit d23190303c
20 changed files with 49 additions and 48 deletions

View File

@@ -101,7 +101,8 @@ class Address extends BaseAction implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
TheliaEvents::ADDRESS_CREATE => array("create", 128) TheliaEvents::ADDRESS_CREATE => array("create", 128),
TheliaEvents::ADDRESS_UPDATE => array("update", 128)
); );
} }
} }

View File

@@ -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( return array(
TheliaEvents::CATEGORY_CREATE => array("create", 128), 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_DELETE => array("delete", 128),
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),

View File

@@ -148,7 +148,7 @@ class Config extends BaseAction implements EventSubscriberInterface
return array( return array(
TheliaEvents::CONFIG_CREATE => array("create", 128), TheliaEvents::CONFIG_CREATE => array("create", 128),
TheliaEvents::CONFIG_SETVALUE => array("setValue", 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), TheliaEvents::CONFIG_DELETE => array("delete", 128),
); );
} }

View File

@@ -113,7 +113,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
{ {
return array( return array(
TheliaEvents::CURRENCY_CREATE => array("create", 128), TheliaEvents::CURRENCY_CREATE => array("create", 128),
TheliaEvents::CURRENCY_MODIFY => array("modify", 128), TheliaEvents::CURRENCY_UPDATE => array("modify", 128),
TheliaEvents::CURRENCY_DELETE => array("delete", 128), TheliaEvents::CURRENCY_DELETE => array("delete", 128),
); );
} }

View File

@@ -118,7 +118,7 @@ class Message extends BaseAction implements EventSubscriberInterface
{ {
return array( return array(
TheliaEvents::MESSAGE_CREATE => array("create", 128), TheliaEvents::MESSAGE_CREATE => array("create", 128),
TheliaEvents::MESSAGE_MODIFY => array("modify", 128), TheliaEvents::MESSAGE_UPDATE => array("modify", 128),
TheliaEvents::MESSAGE_DELETE => array("delete", 128), TheliaEvents::MESSAGE_DELETE => array("delete", 128),
); );
} }

View File

@@ -210,7 +210,7 @@ class ConfigController extends BaseAdminController
->setPostscriptum($data['postscriptum']) ->setPostscriptum($data['postscriptum'])
; ;
$this->dispatch(TheliaEvents::CONFIG_MODIFY, $changeEvent); $this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent);
// Log config modification // Log config modification
$changedObject = $changeEvent->getConfig(); $changedObject = $changeEvent->getConfig();

View File

@@ -218,7 +218,7 @@ class CurrencyController extends BaseAdminController
->setRate($data['rate']) ->setRate($data['rate'])
; ;
$this->dispatch(TheliaEvents::CURRENCY_MODIFY, $changeEvent); $this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
// Log currency modification // Log currency modification
$changedObject = $changeEvent->getCurrency(); $changedObject = $changeEvent->getCurrency();

View File

@@ -204,7 +204,7 @@ class MessageController extends BaseAdminController
->setTextMessage($data['text_message']) ->setTextMessage($data['text_message'])
; ;
$this->dispatch(TheliaEvents::MESSAGE_MODIFY, $changeEvent); $this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent);
// Log message modification // Log message modification
$changedObject = $changeEvent->getMessage(); $changedObject = $changeEvent->getMessage();

View File

@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
$cartEvent->setQuantity($this->getRequest()->get("quantity")); $cartEvent->setQuantity($this->getRequest()->get("quantity"));
try { try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
$this->redirectSuccess(); $this->redirectSuccess();
} catch(PropelException $e) { } catch(PropelException $e) {

View File

@@ -113,7 +113,7 @@ final class TheliaEvents
* Create, change or delete a category * Create, change or delete a category
*/ */
const CATEGORY_CREATE = "action.createCategory"; const CATEGORY_CREATE = "action.createCategory";
const CATEGORY_MODIFY = "action.modifyCategory"; const CATEGORY_UPDATE = "action.updateCategory";
const CATEGORY_DELETE = "action.deleteCategory"; const CATEGORY_DELETE = "action.deleteCategory";
/** /**
@@ -143,12 +143,12 @@ final class TheliaEvents
/** /**
* Sent just before a successful change of a category in the database. * 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. * 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 * 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 * sent when a cart item is modify
*/ */
const AFTER_CARTCHANGEITEM = "cart.modifyItem"; const AFTER_CARTUPDATEITEM = "cart.updateItem";
/** /**
* sent for addArticle action * sent for addArticle action
@@ -173,7 +173,7 @@ final class TheliaEvents
/** /**
* sent on modify article action * sent on modify article action
*/ */
const CART_CHANGEITEM = "action.changeArticle"; const CART_UPDATEITEM = "action.updateArticle";
const CART_DELETEITEM = "action.deleteArticle"; const CART_DELETEITEM = "action.deleteArticle";
@@ -191,14 +191,14 @@ final class TheliaEvents
const CONFIG_CREATE = "action.createConfig"; const CONFIG_CREATE = "action.createConfig";
const CONFIG_SETVALUE = "action.setConfigValue"; const CONFIG_SETVALUE = "action.setConfigValue";
const CONFIG_MODIFY = "action.changeConfig"; const CONFIG_UPDATE = "action.updateConfig";
const CONFIG_DELETE = "action.deleteConfig"; const CONFIG_DELETE = "action.deleteConfig";
const BEFORE_CREATECONFIG = "action.before_createConfig"; const BEFORE_CREATECONFIG = "action.before_createConfig";
const AFTER_CREATECONFIG = "action.after_createConfig"; const AFTER_CREATECONFIG = "action.after_createConfig";
const BEFORE_CHANGECONFIG = "action.before_changeConfig"; const BEFORE_UPDATECONFIG = "action.before_updateConfig";
const AFTER_CHANGECONFIG = "action.after_changeConfig"; const AFTER_UPDATECONFIG = "action.after_updateConfig";
const BEFORE_DELETECONFIG = "action.before_deleteConfig"; const BEFORE_DELETECONFIG = "action.before_deleteConfig";
const AFTER_DELETECONFIG = "action.after_deleteConfig"; const AFTER_DELETECONFIG = "action.after_deleteConfig";
@@ -206,14 +206,14 @@ final class TheliaEvents
// -- Messages management --------------------------------------------- // -- Messages management ---------------------------------------------
const MESSAGE_CREATE = "action.createMessage"; const MESSAGE_CREATE = "action.createMessage";
const MESSAGE_MODIFY = "action.changeMessage"; const MESSAGE_UPDATE = "action.updateMessage";
const MESSAGE_DELETE = "action.deleteMessage"; const MESSAGE_DELETE = "action.deleteMessage";
const BEFORE_CREATEMESSAGE = "action.before_createMessage"; const BEFORE_CREATEMESSAGE = "action.before_createMessage";
const AFTER_CREATEMESSAGE = "action.after_createMessage"; const AFTER_CREATEMESSAGE = "action.after_createMessage";
const BEFORE_CHANGEMESSAGE = "action.before_changeMessage"; const BEFORE_UPDATEMESSAGE = "action.before_updateMessage";
const AFTER_CHANGEMESSAGE = "action.after_changeMessage"; const AFTER_UPDATEMESSAGE = "action.after_updateMessage";
const BEFORE_DELETEMESSAGE = "action.before_deleteMessage"; const BEFORE_DELETEMESSAGE = "action.before_deleteMessage";
const AFTER_DELETEMESSAGE = "action.after_deleteMessage"; const AFTER_DELETEMESSAGE = "action.after_deleteMessage";
@@ -221,14 +221,14 @@ final class TheliaEvents
// -- Currencies management --------------------------------------------- // -- Currencies management ---------------------------------------------
const CURRENCY_CREATE = "action.createCurrency"; const CURRENCY_CREATE = "action.createCurrency";
const CURRENCY_MODIFY = "action.changeCurrency"; const CURRENCY_UPDATE = "action.updateCurrency";
const CURRENCY_DELETE = "action.deleteCurrency"; const CURRENCY_DELETE = "action.deleteCurrency";
const BEFORE_CREATECURRENCY = "action.before_createCurrency"; const BEFORE_CREATECURRENCY = "action.before_createCurrency";
const AFTER_CREATECURRENCY = "action.after_createCurrency"; const AFTER_CREATECURRENCY = "action.after_createCurrency";
const BEFORE_CHANGECURRENCY = "action.before_changeCurrency"; const BEFORE_UPDATECURRENCY = "action.before_updateCurrency";
const AFTER_CHANGECURRENCY = "action.after_changeCurrency"; const AFTER_UPDATECURRENCY = "action.after_updateCurrency";
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency"; const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; const AFTER_DELETECURRENCY = "action.after_deleteCurrency";

View File

@@ -32,7 +32,7 @@ class CartItem extends BaseCartItem
if ($this->dispatcher) { if ($this->dispatcher) {
$cartEvent = new CartEvent($this->getCart()); $cartEvent = new CartEvent($this->getCart());
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent);
} }
} }

View File

@@ -95,14 +95,14 @@ class Category extends BaseCategory
public function preUpdate(ConnectionInterface $con = null) public function preUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECATEGORY, new CategoryEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY, new CategoryEvent($this));
return true; return true;
} }
public function postUpdate(ConnectionInterface $con = null) 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) public function preDelete(ConnectionInterface $con = null)

View File

@@ -55,7 +55,7 @@ class Config extends BaseConfig {
*/ */
public function preUpdate(ConnectionInterface $con = null) public function preUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECONFIG, new ConfigEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECONFIG, new ConfigEvent($this));
return true; return true;
} }
@@ -65,7 +65,7 @@ class Config extends BaseConfig {
*/ */
public function postUpdate(ConnectionInterface $con = null) public function postUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECONFIG, new ConfigEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this));
} }
/** /**

View File

@@ -34,7 +34,7 @@ class Currency extends BaseCurrency {
*/ */
public function preUpdate(ConnectionInterface $con = null) public function preUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECURRENCY, new CurrencyEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECURRENCY, new CurrencyEvent($this));
return true; return true;
} }
@@ -44,7 +44,7 @@ class Currency extends BaseCurrency {
*/ */
public function postUpdate(ConnectionInterface $con = null) public function postUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECURRENCY, new CurrencyEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_UPDATECURRENCY, new CurrencyEvent($this));
} }
/** /**

View File

@@ -34,7 +34,7 @@ class Message extends BaseMessage {
*/ */
public function preUpdate(ConnectionInterface $con = null) public function preUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGEMESSAGE, new MessageEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEMESSAGE, new MessageEvent($this));
return true; return true;
} }
@@ -44,7 +44,7 @@ class Message extends BaseMessage {
*/ */
public function postUpdate(ConnectionInterface $con = null) public function postUpdate(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::AFTER_CHANGEMESSAGE, new MessageEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_UPDATEMESSAGE, new MessageEvent($this));
} }
/** /**

View File

@@ -1637,12 +1637,12 @@
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CREATECATEGORY" class="">AFTER_CREATECATEGORY</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CREATECATEGORY" class="">AFTER_CREATECATEGORY</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_DELETECATEGORY" class="">BEFORE_DELETECATEGORY</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_DELETECATEGORY" class="">BEFORE_DELETECATEGORY</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_DELETECATEGORY" class="">AFTER_DELETECATEGORY</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_DELETECATEGORY" class="">AFTER_DELETECATEGORY</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECATEGORY" class="">AFTER_CHANGECATEGORY</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECATEGORY" class="">AFTER_UPDATECATEGORY</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DUPLICATE" class="">CART_DUPLICATE</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DUPLICATE" class="">CART_DUPLICATE</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTADDITEM" class="">AFTER_CARTADDITEM</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTADDITEM" class="">AFTER_CARTADDITEM</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTCHANGEITEM" class="">AFTER_CARTCHANGEITEM</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTCHANGEITEM" class="">AFTER_CARTUPDATEITEM</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_ADDITEM" class="">CART_ADDITEM</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_ADDITEM" class="">CART_ADDITEM</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_CHANGEITEM" class="">CART_CHANGEITEM</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_CHANGEITEM" class="">CART_UPDATEITEM</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DELETEITEM" class="">CART_DELETEITEM</a><br /> <a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DELETEITEM" class="">CART_DELETEITEM</a><br />
</section> </section>
</section> </section>
@@ -2023,8 +2023,8 @@
<div class="span8 content class"> <div class="span8 content class">
<a id="constant_AFTER_CHANGECATEGORY" name="constant_AFTER_CHANGECATEGORY" class="anchor"></a> <a id="constant_AFTER_CHANGECATEGORY" name="constant_AFTER_CHANGECATEGORY" class="anchor"></a>
<article id="constant_AFTER_CHANGECATEGORY" class="constant"> <article id="constant_AFTER_CHANGECATEGORY" class="constant">
<h3 class="">AFTER_CHANGECATEGORY</h3> <h3 class="">AFTER_UPDATECATEGORY</h3>
<pre class="signature">AFTER_CHANGECATEGORY</pre> <pre class="signature">AFTER_UPDATECATEGORY</pre>
<p><em>Sent just after a successful change of a category in the database.</em></p> <p><em>Sent just after a successful change of a category in the database.</em></p>
@@ -2089,8 +2089,8 @@
<div class="span8 content class"> <div class="span8 content class">
<a id="constant_AFTER_CARTCHANGEITEM" name="constant_AFTER_CARTCHANGEITEM" class="anchor"></a> <a id="constant_AFTER_CARTCHANGEITEM" name="constant_AFTER_CARTCHANGEITEM" class="anchor"></a>
<article id="constant_AFTER_CARTCHANGEITEM" class="constant"> <article id="constant_AFTER_CARTCHANGEITEM" class="constant">
<h3 class="">AFTER_CARTCHANGEITEM</h3> <h3 class="">AFTER_CARTUPDATEITEM</h3>
<pre class="signature">AFTER_CARTCHANGEITEM</pre> <pre class="signature">AFTER_CARTUPDATEITEM</pre>
<p><em>sent when a cart item is modify</em></p> <p><em>sent when a cart item is modify</em></p>
@@ -2133,8 +2133,8 @@
<div class="span8 content class"> <div class="span8 content class">
<a id="constant_CART_CHANGEITEM" name="constant_CART_CHANGEITEM" class="anchor"></a> <a id="constant_CART_CHANGEITEM" name="constant_CART_CHANGEITEM" class="anchor"></a>
<article id="constant_CART_CHANGEITEM" class="constant"> <article id="constant_CART_CHANGEITEM" class="constant">
<h3 class="">CART_CHANGEITEM</h3> <h3 class="">CART_UPDATEITEM</h3>
<pre class="signature">CART_CHANGEITEM</pre> <pre class="signature">CART_UPDATEITEM</pre>
<p><em>sent on modify article action</em></p> <p><em>sent on modify article action</em></p>

View File

@@ -227,7 +227,7 @@ class Category extends BaseAction implements EventSubscriberInterface
$categoryEvent = new CategoryEvent($category); $categoryEvent = new CategoryEvent($category);
$event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $categoryEvent); $event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECATEGORY, $categoryEvent);
} }
} }

View File

@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
$cartEvent->setQuantity($this->getRequest()->get("quantity")); $cartEvent->setQuantity($this->getRequest()->get("quantity"));
try { try {
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
$this->redirectSuccess(); $this->redirectSuccess();
} catch(PropelException $e) { } catch(PropelException $e) {

View File

@@ -106,7 +106,7 @@ final class TheliaEvents
/** /**
* Sent just after a successful change of a category in the database. * 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 * 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 * sent when a cart item is modify
*/ */
const AFTER_CARTCHANGEITEM = "cart.modifyItem"; const AFTER_CARTUPDATEITEM = "cart.modifyItem";
/** /**
* sent for addArticle action * sent for addArticle action
@@ -131,7 +131,7 @@ final class TheliaEvents
/** /**
* sent on modify article action * sent on modify article action
*/ */
const CART_CHANGEITEM = "action.changeArticle"; const CART_UPDATEITEM = "action.changeArticle";
const CART_DELETEITEM = "action.deleteArticle"; const CART_DELETEITEM = "action.deleteArticle";
} }

View File

@@ -32,7 +32,7 @@ class CartItem extends BaseCartItem
if ($this->dispatcher) { if ($this->dispatcher) {
$cartEvent = new CartEvent($this->getCart()); $cartEvent = new CartEvent($this->getCart());
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent);
} }
} }