remove all callback in customer class before saving it

This commit is contained in:
Manuel Raynaud
2014-03-13 17:10:21 +01:00
parent b0b0eac1cf
commit 613aac093e
2 changed files with 10 additions and 0 deletions

View File

@@ -147,6 +147,11 @@ class Customer extends BaseAction implements EventSubscriberInterface
public function login(CustomerLoginEvent $event) public function login(CustomerLoginEvent $event)
{ {
$customer = $event->getCustomer();
if (method_exists($customer, 'clearDispatcher')) {
$customer->clearDispatcher();
}
$this->securityContext->setCustomerUser($event->getCustomer()); $this->securityContext->setCustomerUser($event->getCustomer());
} }

View File

@@ -53,6 +53,11 @@ trait ModelEventDispatcherTrait
return $this->dispatcher; return $this->dispatcher;
} }
public function clearDispatcher()
{
$this->dispatcher = null;
}
protected function dispatchEvent($eventName, ActionEvent $event) protected function dispatchEvent($eventName, ActionEvent $event)
{ {
if (!is_null($this->dispatcher)) { if (!is_null($this->dispatcher)) {