validate create and update address in front context

This commit is contained in:
Manuel Raynaud
2013-09-04 17:52:58 +02:00
parent 3cb4e6ff2e
commit ceb02841e1
21 changed files with 482 additions and 65 deletions

View File

@@ -1631,8 +1631,8 @@
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_ADMIN_LOGIN" class="">ADMIN_LOGIN</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_CREATECUSTOMER" class="">BEFORE_CREATECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CREATECUSTOMER" class="">AFTER_CREATECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_CHANGECUSTOMER" class="">BEFORE_CHANGECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECUSTOMER" class="">AFTER_CHANGECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_CHANGECUSTOMER" class="">BEFORE_UPDATECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECUSTOMER" class="">AFTER_UPDATECUSTOMER</a><br />
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_CREATECATEGORY" class="">BEFORE_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 />
@@ -1891,8 +1891,8 @@
<div class="span8 content class">
<a id="constant_BEFORE_CHANGECUSTOMER" name="constant_BEFORE_CHANGECUSTOMER" class="anchor"></a>
<article id="constant_BEFORE_CHANGECUSTOMER" class="constant">
<h3 class="">BEFORE_CHANGECUSTOMER</h3>
<pre class="signature">BEFORE_CHANGECUSTOMER</pre>
<h3 class="">BEFORE_UPDATECUSTOMER</h3>
<pre class="signature">BEFORE_UPDATECUSTOMER</pre>
<p><em>Sent once the customer change form has been successfully validated, and before customer update in the database.</em></p>
@@ -1913,8 +1913,8 @@
<div class="span8 content class">
<a id="constant_AFTER_CHANGECUSTOMER" name="constant_AFTER_CHANGECUSTOMER" class="anchor"></a>
<article id="constant_AFTER_CHANGECUSTOMER" class="constant">
<h3 class="">AFTER_CHANGECUSTOMER</h3>
<pre class="signature">AFTER_CHANGECUSTOMER</pre>
<h3 class="">AFTER_UPDATECUSTOMER</h3>
<pre class="signature">AFTER_UPDATECUSTOMER</pre>
<p><em>Sent just after a successful update of a customer in the database.</em></p>

View File

@@ -109,7 +109,7 @@ class Category extends BaseAction implements EventSubscriberInterface
$customer = CustomerQuery::create()->findPk(1);
try {
$customerEvent = new CustomerEvent($customer);
$event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent);
$event->getDispatcher()->dispatch(TheliaEvents::BEFORE_UPDATECUSTOMER, $customerEvent);
$data = $form->getData();
@@ -127,7 +127,7 @@ class Category extends BaseAction implements EventSubscriberInterface
);
$customerEvent->customer = $customer;
$event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent);
$event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECUSTOMER, $customerEvent);
// Update the logged-in user, and redirect to the success URL (exits)
// We don-t send the login event, as the customer si already logged.

View File

@@ -78,11 +78,11 @@ 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_UPDATECUSTOMER = "action.before_changecustomer";
/**
* Sent just after a successful update of a customer in the database.
*/
const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
const AFTER_UPDATECUSTOMER = "action.after_changecustomer";
/**
* Sent once the category creation form has been successfully validated, and before category insertion in the database.

View File

@@ -125,7 +125,7 @@ class Customer extends BaseCustomer implements UserInterface
public function preUpdate(ConnectionInterface $con = null)
{
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent);
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECUSTOMER, $customerEvent);
return true;
}
@@ -133,7 +133,7 @@ class Customer extends BaseCustomer implements UserInterface
public function postUpdate(ConnectionInterface $con = null)
{
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent);
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECUSTOMER, $customerEvent);
}
protected function dispatchEvent($eventName, CustomerEvent $customerEvent)