diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 3a39a4bf2..6ed4b480d 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -25,6 +25,7 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\ActionEvent; +use Thelia\Core\Event\CustomerEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\BaseForm; use Thelia\Form\CustomerCreation; @@ -88,8 +89,8 @@ class Customer implements EventSubscriberInterface $data["password"], $request->getSession()->getLang() ); - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $event); + $customerEvent = new CustomerEvent($customer); + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $customerEvent); // Connect the newly created user,and redirect to the success URL $this->processSuccessfulLogin($event, $customer, $customerCreationForm, true); @@ -136,7 +137,8 @@ class Customer implements EventSubscriberInterface $customer = CustomerQuery::create()->findPk(1); try { - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $event); + $customerEvent = new CustomerEvent($customer); + $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); $data = $form->getData(); @@ -153,7 +155,8 @@ class Customer implements EventSubscriberInterface $data["country"] ); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $event); + $customerEvent->customer = $customer; + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $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. diff --git a/core/lib/Thelia/Core/Event/CustomerEvent.php b/core/lib/Thelia/Core/Event/CustomerEvent.php new file mode 100644 index 000000000..f9f00278d --- /dev/null +++ b/core/lib/Thelia/Core/Event/CustomerEvent.php @@ -0,0 +1,38 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + + +use Thelia\Model\Customer; + +class CustomerEvent extends InternalEvent { + + public $customer; + + public function __construct(Customer $customer) + { + $this->customer = $customer; + } + +} \ No newline at end of file