From 44249859ef81a95487a9c6c230b113a2db44ea31 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 16 Aug 2013 10:35:46 +0200 Subject: [PATCH] create new customerEvent class --- .../Thelia/Config/Resources/routing/front.xml | 5 - .../Controller/Front/CustomerController.php | 13 +- .../Thelia/Core/Event/CustomerCreateEvent.php | 155 ++++++++++++++++++ 3 files changed, 159 insertions(+), 14 deletions(-) create mode 100644 core/lib/Thelia/Core/Event/CustomerCreateEvent.php diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index df08b88da..c1e8f82e2 100644 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -14,11 +14,6 @@ connexion - - Thelia\Controller\Front\CustomerController::displayCreateAction - connexion - - Thelia\Controller\Front\CartController::addItem cart diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 231ac5905..69c055959 100644 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -24,6 +24,7 @@ namespace Thelia\Controller\Front; use Thelia\Core\Event\CustomerEvent; use Thelia\Core\Security\SecurityContext; +use Thelia\Form\CustomerCreation; use Thelia\Model\Customer; use Thelia\Core\Event\TheliaEvents; @@ -31,16 +32,10 @@ class CustomerController extends BaseFrontController { public function createAction() { + $request = $this->getRequest(); + $customerCreation = new CustomerCreation($$request); - $event = $this->dispatchEvent("createCustomer"); - if (null !== $customer = $event->customer) { - $this->processLogin($event->customer); - } - - } - - public function displayCreateAction() - { + $form = $this->validateForm($customerCreation, "post"); } diff --git a/core/lib/Thelia/Core/Event/CustomerCreateEvent.php b/core/lib/Thelia/Core/Event/CustomerCreateEvent.php new file mode 100644 index 000000000..45bf4d639 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CustomerCreateEvent.php @@ -0,0 +1,155 @@ +address1 = $address1; + $this->address2 = $address2; + $this->address3 = $address3; + $this->country = $country; + $this->email = $email; + $this->firstname = $firstname; + $this->lang = $lang; + $this->lastname = $lastname; + $this->password = $password; + $this->phone = $phone; + $this->title = $title; + $this->zipcode = $zipcode; + } + + /** + * @return string + */ + public function getAddress1() + { + return $this->address1; + } + + /** + * @return string + */ + public function getAddress2() + { + return $this->address2; + } + + /** + * @return string + */ + public function getAddress3() + { + return $this->address3; + } + + /** + * @return int + */ + public function getCountry() + { + return $this->country; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @return string + */ + public function getFirstname() + { + return $this->firstname; + } + + /** + * @return mixed + */ + public function getLang() + { + return $this->lang; + } + + /** + * @return string + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @return int + */ + public function getTitle() + { + return $this->title; + } + + /** + * @return string + */ + public function getZipcode() + { + return $this->zipcode; + } + + + +} \ No newline at end of file