From 613aac093e544f05b52e5f714855bd408c2f121c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 13 Mar 2014 17:10:21 +0100 Subject: [PATCH] remove all callback in customer class before saving it --- core/lib/Thelia/Action/Customer.php | 5 +++++ core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 6220aefe5..30e6a573b 100644 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -147,6 +147,11 @@ class Customer extends BaseAction implements EventSubscriberInterface public function login(CustomerLoginEvent $event) { + $customer = $event->getCustomer(); + + if (method_exists($customer, 'clearDispatcher')) { + $customer->clearDispatcher(); + } $this->securityContext->setCustomerUser($event->getCustomer()); } diff --git a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php index 759d032d4..10aae9ab4 100644 --- a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php +++ b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php @@ -53,6 +53,11 @@ trait ModelEventDispatcherTrait return $this->dispatcher; } + public function clearDispatcher() + { + $this->dispatcher = null; + } + protected function dispatchEvent($eventName, ActionEvent $event) { if (!is_null($this->dispatcher)) {