From ba32bae40cf01ddaf05f9806bdaaeb0fb931ae91 Mon Sep 17 00:00:00 2001 From: Oliwier Ptak Date: Tue, 24 Jan 2017 15:45:30 +0100 Subject: [PATCH 01/14] CORE-791 case-sensitive propel schema --- .../Zed/Customer/Persistence/CustomerQueryContainer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php b/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php index dee2e281..cbe19f80 100644 --- a/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php +++ b/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php @@ -23,7 +23,7 @@ class CustomerQueryContainer extends AbstractQueryContainer implements CustomerQ public function queryCustomerByEmail($email) { $query = $this->queryCustomers(); - $query->filterByEmail($email); + $query->filterByEmailCaseInsensitive($email); return $query; } @@ -37,7 +37,7 @@ public function queryCustomerByEmailApartFromIdCustomer($email, $exceptIdCustome { $query = $this->queryCustomers(); $query - ->filterByEmail($email) + ->filterByEmailCaseInsensitive($email) ->filterByIdCustomer($exceptIdCustomer, Criteria::NOT_EQUAL); return $query; From 440a326e3c80a32a229ea13e9265e5c13baff8fb Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Wed, 8 Nov 2017 18:25:38 +0000 Subject: [PATCH 02/14] CORE-791: Case insensitive for specific fields --- .../Zed/Customer/Persistence/CustomerQueryContainer.php | 4 ++-- .../Persistence/Propel/Schema/spy_customer.schema.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php b/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php index cbe19f80..dee2e281 100644 --- a/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php +++ b/src/Spryker/Zed/Customer/Persistence/CustomerQueryContainer.php @@ -23,7 +23,7 @@ class CustomerQueryContainer extends AbstractQueryContainer implements CustomerQ public function queryCustomerByEmail($email) { $query = $this->queryCustomers(); - $query->filterByEmailCaseInsensitive($email); + $query->filterByEmail($email); return $query; } @@ -37,7 +37,7 @@ public function queryCustomerByEmailApartFromIdCustomer($email, $exceptIdCustome { $query = $this->queryCustomers(); $query - ->filterByEmailCaseInsensitive($email) + ->filterByEmail($email) ->filterByIdCustomer($exceptIdCustomer, Criteria::NOT_EQUAL); return $query; diff --git a/src/Spryker/Zed/Customer/Persistence/Propel/Schema/spy_customer.schema.xml b/src/Spryker/Zed/Customer/Persistence/Propel/Schema/spy_customer.schema.xml index 1b6bcb1f..71ed73a8 100644 --- a/src/Spryker/Zed/Customer/Persistence/Propel/Schema/spy_customer.schema.xml +++ b/src/Spryker/Zed/Customer/Persistence/Propel/Schema/spy_customer.schema.xml @@ -4,8 +4,8 @@ - - + + From d6b8a2995c7a9f9ea551068311b29f569cdcb848 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 14:47:29 +0000 Subject: [PATCH 03/14] CORE-791: Remove deprecated constant HOST from CustomerConsts --- src/Spryker/Shared/Customer/CustomerConstants.php | 6 ++---- src/Spryker/Zed/Customer/CustomerConfig.php | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Spryker/Shared/Customer/CustomerConstants.php b/src/Spryker/Shared/Customer/CustomerConstants.php index ad1f029c..28892faf 100644 --- a/src/Spryker/Shared/Customer/CustomerConstants.php +++ b/src/Spryker/Shared/Customer/CustomerConstants.php @@ -12,11 +12,9 @@ interface CustomerConstants const CUSTOMER_ANONYMOUS_PATTERN = 'CUSTOMER_ANONYMOUS_PATTERN'; const CUSTOMER_SECURED_PATTERN = 'CUSTOMER_SECURED_PATTERN'; - /** @deprecated Use CustomerConstants::BASE_URL_YVES instead */ - const HOST_YVES = 'HOST_YVES'; - /** - * Base URL for Yves including scheme and port (e.g. http://www.de.demoshop.local:8080) + * Specification: + * - Base URL for Yves including scheme and port (e.g. http://www.de.demoshop.local:8080) * * @api */ diff --git a/src/Spryker/Zed/Customer/CustomerConfig.php b/src/Spryker/Zed/Customer/CustomerConfig.php index 2072bfbd..13e15c8e 100644 --- a/src/Spryker/Zed/Customer/CustomerConfig.php +++ b/src/Spryker/Zed/Customer/CustomerConfig.php @@ -22,10 +22,7 @@ class CustomerConfig extends AbstractBundleConfig */ public function getHostYves() { - return $this->getConfig()->hasKey(CustomerConstants::BASE_URL_YVES) - ? $this->get(CustomerConstants::BASE_URL_YVES) - // @deprecated this is just for backward compatibility - : $this->get(CustomerConstants::HOST_YVES); + return $this->get(CustomerConstants::BASE_URL_YVES); } /** From 75e2d546baa2a556b986f4df7d3e1d5055447ea1 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 14:49:20 +0000 Subject: [PATCH 04/14] CORE-791: Remove deprecated controller actions --- .../Controller/AddressController.php | 78 ------------------- 1 file changed, 78 deletions(-) diff --git a/src/Spryker/Zed/Customer/Communication/Controller/AddressController.php b/src/Spryker/Zed/Customer/Communication/Controller/AddressController.php index 9eed7cef..2a61d3ea 100644 --- a/src/Spryker/Zed/Customer/Communication/Controller/AddressController.php +++ b/src/Spryker/Zed/Customer/Communication/Controller/AddressController.php @@ -18,84 +18,6 @@ */ class AddressController extends AbstractController { - /** - * @deprecated moved to Customer view page ViewController->indexAction() - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return array - */ - public function indexAction(Request $request) - { - $idCustomerRaw = $request->get(CustomerConstants::PARAM_ID_CUSTOMER); - - if (empty($idCustomerRaw)) { - return $this->redirectResponse('/customer'); - } - - $idCustomer = $this->castId($idCustomerRaw); - - $table = $this->getFactory() - ->createCustomerAddressTable($idCustomer); - - return $this->viewResponse([ - 'addressTable' => $table->render(), - 'idCustomer' => $idCustomer, - ]); - } - - /** - * @deprecated moved to Customer view page ViewController->indexAction() - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\JsonResponse - */ - public function tableAction(Request $request) - { - $idCustomer = $this->castId($request->get(CustomerConstants::PARAM_ID_CUSTOMER)); - - $table = $this->getFactory() - ->createCustomerAddressTable($idCustomer); - - return $this->jsonResponse($table->fetchData()); - } - - /** - * @deprecated Address has no detail page anymore - * - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return array - */ - public function viewAction(Request $request) - { - $idCustomer = false; - $idCustomerAddress = $this->castId($request->get(CustomerConstants::PARAM_ID_CUSTOMER_ADDRESS)); - - $customerAddress = $this->createCustomerAddressTransfer(); - $customerAddress->setIdCustomerAddress($idCustomerAddress); - - $addressDetails = $this->getFacade() - ->getAddress($customerAddress); - - if (empty($addressDetails) === false) { - $idCustomer = $addressDetails->getFkCustomer(); - } - - $customerAddressTransfer = $this->createCustomerAddressTransfer(); - $customerAddressTransfer->setIdCustomerAddress($idCustomerAddress); - - $address = $this->getFacade() - ->getAddress($customerAddressTransfer); - - return $this->viewResponse([ - 'address' => $address->toArray(), - 'idCustomer' => $idCustomer, - 'idCustomerAddress' => $idCustomerAddress, - ]); - } - /** * @param \Symfony\Component\HttpFoundation\Request $request * From 7026fe428dc6c9b5e1201ba9aa28f4d7679e51b7 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 14:58:14 +0000 Subject: [PATCH 05/14] CORE-791: Remove deprecations from Customer module --- .../Zed/Customer/Business/Customer/Address.php | 9 +++++---- .../Zed/Customer/Communication/Form/AddressForm.php | 12 ------------ .../Zed/Customer/Communication/Form/CustomerForm.php | 12 ------------ .../Communication/Form/CustomerUpdateForm.php | 12 ------------ .../Dependency/Facade/CustomerToCountryBridge.php | 12 ------------ .../Dependency/Facade/CustomerToCountryInterface.php | 9 --------- 6 files changed, 5 insertions(+), 61 deletions(-) diff --git a/src/Spryker/Zed/Customer/Business/Customer/Address.php b/src/Spryker/Zed/Customer/Business/Customer/Address.php index 2126fb27..3de735ef 100644 --- a/src/Spryker/Zed/Customer/Business/Customer/Address.php +++ b/src/Spryker/Zed/Customer/Business/Customer/Address.php @@ -358,16 +358,16 @@ protected function getCustomerFromCustomerTransfer(CustomerTransfer $customerTra */ protected function getCustomerCountryId() { - $idCountry = $this->countryFacade->getIdCountryByIso2Code($this->getIsoCode()); + $countryTransfer = $this->countryFacade->getCountryByIso2Code($this->getIsoCode()); - if ($idCountry === null) { + if ($countryTransfer->getIdCountry()) { throw new CountryNotFoundException(sprintf( 'Country not found for ISO code `%s`.', $this->getIsoCode() )); } - return $idCountry; + return $countryTransfer->getIdCountry(); } /** @@ -465,7 +465,8 @@ protected function retrieveFkCountry(AddressTransfer $addressTransfer) if (empty($fkCountry)) { $iso2Code = $addressTransfer->getIso2Code(); if (empty($iso2Code) === false) { - $fkCountry = $this->countryFacade->getIdCountryByIso2Code($iso2Code); + $countryTransfer = $this->countryFacade->getCountryByIso2Code($iso2Code); + $fkCountry = $countryTransfer->getIdCountry(); } else { $fkCountry = $this->getCustomerCountryId(); } diff --git a/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php b/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php index 84f7e8bc..7fd12881 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php @@ -53,18 +53,6 @@ public function configureOptions(OptionsResolver $resolver) ]); } - /** - * @deprecated Use `configureOptions()` instead. - * - * @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver - * - * @return void - */ - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - $this->configureOptions($resolver); - } - /** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options diff --git a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php index 9fc617d0..102817d1 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php @@ -64,18 +64,6 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setRequired(self::OPTION_GENDER_CHOICES); } - /** - * @deprecated Use `configureOptions()` instead. - * - * @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver - * - * @return void - */ - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - $this->configureOptions($resolver); - } - /** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options diff --git a/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php b/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php index 6d2d26ab..b1d8f7e8 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php @@ -30,18 +30,6 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setRequired(self::OPTION_ADDRESS_CHOICES); } - /** - * @deprecated Use `configureOptions()` instead. - * - * @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver - * - * @return void - */ - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - $this->configureOptions($resolver); - } - /** * @param \Symfony\Component\Form\FormBuilderInterface $builder * @param array $options diff --git a/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php b/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php index 5277c150..a680fdc4 100644 --- a/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php +++ b/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryBridge.php @@ -40,18 +40,6 @@ public function getAvailableCountries() return $this->countryFacade->getAvailableCountries(); } - /** - * @deprecated Use getCountryByIso2Code() instead. - * - * @param string $iso2Code - * - * @return int - */ - public function getIdCountryByIso2Code($iso2Code) - { - return $this->countryFacade->getIdCountryByIso2Code($iso2Code); - } - /** * @param string $iso2Code * diff --git a/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php b/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php index f3f39a6e..a7d2a7ee 100644 --- a/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php +++ b/src/Spryker/Zed/Customer/Dependency/Facade/CustomerToCountryInterface.php @@ -9,15 +9,6 @@ interface CustomerToCountryInterface { - /** - * @deprecated Use getCountryByIso2Code() instead. - * - * @param string $iso2Code - * - * @return int - */ - public function getIdCountryByIso2Code($iso2Code); - /** * @param string $countryName * From fe08397c55a680d85fcb9072f4e72f93475590c6 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 15:00:27 +0000 Subject: [PATCH 06/14] CORE-791: Update facade --- .../Zed/Customer/Business/CustomerFacade.php | 16 ---------------- .../Business/CustomerFacadeInterface.php | 14 -------------- 2 files changed, 30 deletions(-) diff --git a/src/Spryker/Zed/Customer/Business/CustomerFacade.php b/src/Spryker/Zed/Customer/Business/CustomerFacade.php index 1bed9a60..20abc773 100644 --- a/src/Spryker/Zed/Customer/Business/CustomerFacade.php +++ b/src/Spryker/Zed/Customer/Business/CustomerFacade.php @@ -83,22 +83,6 @@ public function confirmRegistration(CustomerTransfer $customerTransfer) ->confirmRegistration($customerTransfer); } - /** - * {@inheritdoc} - * - * @api - * - * @deprecated Use CustomerFacade::sendPasswordRestoreMail() instead - * - * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer - * - * @return \Generated\Shared\Transfer\CustomerResponseTransfer - */ - public function forgotPassword(CustomerTransfer $customerTransfer) - { - return $this->sendPasswordRestoreMail($customerTransfer); - } - /** * {@inheritdoc} * diff --git a/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php b/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php index 355584d0..fe21470b 100644 --- a/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php +++ b/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php @@ -74,20 +74,6 @@ public function registerCustomer(CustomerTransfer $customerTransfer); */ public function confirmRegistration(CustomerTransfer $customerTransfer); - /** - * Specification: - * - Sends password restoration link via email using a freshly generated password restoration key. - * - * @api - * - * @deprecated Use sendPasswordRestoreMail() instead - * - * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer - * - * @return \Generated\Shared\Transfer\CustomerResponseTransfer - */ - public function forgotPassword(CustomerTransfer $customerTransfer); - /** * Specification: * - Sends password restoration link via email using a freshly generated password restoration key. From 5a4f9f928062291753db692a36737670a1fac0f2 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 15:05:01 +0000 Subject: [PATCH 07/14] CORE-791: Codestyle fixes --- src/Spryker/Zed/Customer/Communication/Form/AddressForm.php | 1 - src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php | 1 - .../Zed/Customer/Communication/Form/CustomerUpdateForm.php | 1 - 3 files changed, 3 deletions(-) diff --git a/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php b/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php index 7fd12881..29b17d4f 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/AddressForm.php @@ -10,7 +10,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Required; diff --git a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php index 102817d1..d069b98e 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/CustomerForm.php @@ -11,7 +11,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\Length; diff --git a/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php b/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php index b1d8f7e8..27866a77 100644 --- a/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php +++ b/src/Spryker/Zed/Customer/Communication/Form/CustomerUpdateForm.php @@ -9,7 +9,6 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; class CustomerUpdateForm extends CustomerForm { From 193ecf91af4120ac49289c4e6ff991b94a5e60dd Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 15:24:18 +0000 Subject: [PATCH 08/14] CORE-791: Cleanup from release app --- .../Client/Customer/CustomerClient.php | 23 ------------------- .../Customer/CustomerClientInterface.php | 13 ----------- .../Controller/AddController.php | 8 ------- 3 files changed, 44 deletions(-) diff --git a/src/Spryker/Client/Customer/CustomerClient.php b/src/Spryker/Client/Customer/CustomerClient.php index b96c2edd..30e2ea2a 100644 --- a/src/Spryker/Client/Customer/CustomerClient.php +++ b/src/Spryker/Client/Customer/CustomerClient.php @@ -16,29 +16,6 @@ */ class CustomerClient extends AbstractClient implements CustomerClientInterface { - /** - * {@inheritdoc} - * - * @api - * - * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer - * - * @return bool - */ - public function hasCustomerWithEmailAndPassword(CustomerTransfer $customerTransfer) - { - $customerResponseTransfer = $this->getFactory() - ->createZedCustomerStub() - ->hasCustomerWithEmailAndPassword($customerTransfer); - - $hasCustomer = $customerResponseTransfer->getHasCustomer(); - if ($hasCustomer === true) { - $this->setCustomer($customerResponseTransfer->getCustomerTransfer()); - } - - return $hasCustomer; - } - /** * {@inheritdoc} * diff --git a/src/Spryker/Client/Customer/CustomerClientInterface.php b/src/Spryker/Client/Customer/CustomerClientInterface.php index 4dcc37e7..714af97b 100644 --- a/src/Spryker/Client/Customer/CustomerClientInterface.php +++ b/src/Spryker/Client/Customer/CustomerClientInterface.php @@ -12,19 +12,6 @@ interface CustomerClientInterface { - /** - * Specification: - * - Checks if customer exists in persistent storage by provided email and plain text password. - * - Stores found customer information in session. - * - * @api - * - * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer - * - * @return bool - */ - public function hasCustomerWithEmailAndPassword(CustomerTransfer $customerTransfer); - /** * Specification: * - Checks if customer exists in persistent storage by provided email and plain text password. diff --git a/src/Spryker/Zed/Customer/Communication/Controller/AddController.php b/src/Spryker/Zed/Customer/Communication/Controller/AddController.php index ea3f0572..57b2b3cd 100644 --- a/src/Spryker/Zed/Customer/Communication/Controller/AddController.php +++ b/src/Spryker/Zed/Customer/Communication/Controller/AddController.php @@ -46,12 +46,4 @@ public function indexAction(Request $request) 'form' => $form->createView(), ]); } - - /** - * @return \Generated\Shared\Transfer\CustomerTransfer - */ - protected function createCustomerTransfer() - { - return new CustomerTransfer(); - } } From f8a4093f0adfa6bdf195c9472754e9bc50cb51bb Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Fri, 10 Nov 2017 15:32:06 +0000 Subject: [PATCH 09/14] CORE-791: Remove a deprecated interface --- .../Service/CustomerToUtilSanitizeInterface.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeInterface.php diff --git a/src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeInterface.php b/src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeInterface.php deleted file mode 100644 index 915a7c0d..00000000 --- a/src/Spryker/Zed/Customer/Dependency/Service/CustomerToUtilSanitizeInterface.php +++ /dev/null @@ -1,15 +0,0 @@ - Date: Mon, 13 Nov 2017 11:48:31 +0000 Subject: [PATCH 10/14] CORE-791: Fix comparison bug --- composer.json | 2 +- src/Spryker/Zed/Customer/Business/Customer/Address.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 050d45c3..0a398d81 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "spryker/kernel": "^3.0.0", "spryker/locale": "^3.0.0", "spryker/mail": "^4.0.0", - "spryker/propel-orm": "^1.0.0", + "spryker/propel-orm": "^1.5.0", "spryker/sequence-number": "^3.0.0", "spryker/session": "^3.0.0", "spryker/symfony": "^3.0.0", diff --git a/src/Spryker/Zed/Customer/Business/Customer/Address.php b/src/Spryker/Zed/Customer/Business/Customer/Address.php index 3de735ef..bbb35de7 100644 --- a/src/Spryker/Zed/Customer/Business/Customer/Address.php +++ b/src/Spryker/Zed/Customer/Business/Customer/Address.php @@ -360,7 +360,7 @@ protected function getCustomerCountryId() { $countryTransfer = $this->countryFacade->getCountryByIso2Code($this->getIsoCode()); - if ($countryTransfer->getIdCountry()) { + if (!$countryTransfer->getIdCountry()) { throw new CountryNotFoundException(sprintf( 'Country not found for ISO code `%s`.', $this->getIsoCode() From ba34720ff19643226fb90a4b873f665a5949e399 Mon Sep 17 00:00:00 2001 From: Denis Turkov Date: Mon, 13 Nov 2017 14:44:42 +0000 Subject: [PATCH 11/14] CORE-791: Remove country exception so far it's already into the Country module --- .../Zed/Customer/Business/Customer/Address.php | 10 ---------- .../Exception/CountryNotFoundException.php | 14 -------------- 2 files changed, 24 deletions(-) delete mode 100644 src/Spryker/Zed/Customer/Business/Exception/CountryNotFoundException.php diff --git a/src/Spryker/Zed/Customer/Business/Customer/Address.php b/src/Spryker/Zed/Customer/Business/Customer/Address.php index bbb35de7..de1905d7 100644 --- a/src/Spryker/Zed/Customer/Business/Customer/Address.php +++ b/src/Spryker/Zed/Customer/Business/Customer/Address.php @@ -15,7 +15,6 @@ use Orm\Zed\Customer\Persistence\SpyCustomerAddress; use Propel\Runtime\Collection\ObjectCollection; use Spryker\Zed\Customer\Business\Exception\AddressNotFoundException; -use Spryker\Zed\Customer\Business\Exception\CountryNotFoundException; use Spryker\Zed\Customer\Business\Exception\CustomerNotFoundException; use Spryker\Zed\Customer\Dependency\Facade\CustomerToCountryInterface; use Spryker\Zed\Customer\Dependency\Facade\CustomerToLocaleInterface; @@ -352,21 +351,12 @@ protected function getCustomerFromCustomerTransfer(CustomerTransfer $customerTra } /** - * @throws \Spryker\Zed\Customer\Business\Exception\CountryNotFoundException - * * @return int */ protected function getCustomerCountryId() { $countryTransfer = $this->countryFacade->getCountryByIso2Code($this->getIsoCode()); - if (!$countryTransfer->getIdCountry()) { - throw new CountryNotFoundException(sprintf( - 'Country not found for ISO code `%s`.', - $this->getIsoCode() - )); - } - return $countryTransfer->getIdCountry(); } diff --git a/src/Spryker/Zed/Customer/Business/Exception/CountryNotFoundException.php b/src/Spryker/Zed/Customer/Business/Exception/CountryNotFoundException.php deleted file mode 100644 index 6627b469..00000000 --- a/src/Spryker/Zed/Customer/Business/Exception/CountryNotFoundException.php +++ /dev/null @@ -1,14 +0,0 @@ - Date: Mon, 13 Nov 2017 15:25:07 +0000 Subject: [PATCH 12/14] CORE-791: Remove profile controller --- .../Controller/ProfileController.php | 181 ------------------ 1 file changed, 181 deletions(-) delete mode 100644 src/Spryker/Zed/Customer/Communication/Controller/ProfileController.php diff --git a/src/Spryker/Zed/Customer/Communication/Controller/ProfileController.php b/src/Spryker/Zed/Customer/Communication/Controller/ProfileController.php deleted file mode 100644 index fed49552..00000000 --- a/src/Spryker/Zed/Customer/Communication/Controller/ProfileController.php +++ /dev/null @@ -1,181 +0,0 @@ -castId($request->query->get('id')); - - $form = $this->getFactory() - ->createCustomerForm($idCustomer); - - $customerTransfer = new CustomerTransfer(); - $customerTransfer->setIdCustomer($idCustomer); - $customerTransfer = $this->getFacade() - ->getCustomer($customerTransfer); - - try { - $idShippingAddress = $this->getFacade() - ->getDefaultShippingAddress($customerTransfer) - ->getIdCustomerAddress(); - } catch (AddressNotFoundException $e) { - $idShippingAddress = null; - } - - try { - $idBillingAddress = $this->getFacade() - ->getDefaultBillingAddress($customerTransfer) - ->getIdCustomerAddress(); - } catch (AddressNotFoundException $e) { - $idBillingAddress = null; - } - - $addresses = []; - $addressesItems = $customerTransfer->getAddresses() - ->getAddresses(); - foreach ($addressesItems as $address) { - $addresses[] = [ - 'id' => $address->getIdCustomerAddress(), - 'first_name' => $address->getFirstName(), - 'last_name' => $address->getLastName(), - 'address1' => $address->getAddress1(), - 'address2' => $address->getAddress2(), - 'address3' => $address->getAddress3(), - 'company' => $address->getCompany(), - 'zipCode' => $address->getZipCode(), - 'city' => $address->getCity(), - 'isDefaultBilling' => ($address->getIdCustomerAddress() === $idBillingAddress), - 'isDefaultShipping' => ($address->getIdCustomerAddress() === $idShippingAddress), - ]; - } - - return [ - 'idCustomer' => $customerTransfer->getIdCustomer(), - 'customerJson' => json_encode($form->toArray()), - 'registered' => $customerTransfer->getRegistered(), - 'addresses' => $addresses, - 'form' => $form->renderDataForTwig()[self::OUTPUT_PAYLOAD]['fields'], - ]; - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function sendPasswordRestoreTokenAction(Request $request) - { - $customerTransfer = new CustomerTransfer(); - $customerTransfer->setIdCustomer($this->castId($request->query->get('id'))); - $this->getFacade() - ->sendPasswordRestoreMail($customerTransfer); - - return $this->redirectResponse('/customer/profile?id=' . $this->castId($request->query->get('id'))); - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\JsonResponse - */ - public function editAction(Request $request) - { - $form = $this->getFactory() - ->createCustomerForm($request); - - if ($form->isValid() === true) { - $customerTransfer = new CustomerTransfer(); - $customerTransfer->fromArray($form->getRequestData()); - $this->getFacade() - ->updateCustomer($customerTransfer); - } - - return $this->jsonResponse($form->renderData()); - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\JsonResponse - */ - public function addressAction(Request $request) - { - $form = $this->getFactory() - ->createAddressForm($request); - - if ($form->isValid() === true) { - $addressTransfer = new AddressTransfer(); - $addressTransfer->fromArray($form->getRequestData()); - if ($addressTransfer->getIdCustomerAddress()) { - $this->getFacade() - ->updateAddress($addressTransfer); - - return $this->jsonResponse($form->renderData()); - } - - $this->getFacade() - ->createAddress($addressTransfer); - } - - return $this->jsonResponse($form->renderData()); - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function setDefaultShippingAddressAction(Request $request) - { - $addressTransfer = new AddressTransfer(); - $addressTransfer->setIdCustomerAddress($this->castId($request->query->get('address_id'))); - $addressTransfer->setFkCustomer($this->castId($request->query->get('customer_id'))); - $this->getFacade() - ->setDefaultShippingAddress($addressTransfer); - - return $this->redirectResponse('/customer/profile?id=' . $this->castId($request->query->get('customer_id'))); - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - public function setDefaultBillingAddressAction(Request $request) - { - $addressTransfer = new AddressTransfer(); - $addressTransfer->setIdCustomerAddress($this->castId($request->query->get('address_id'))); - $addressTransfer->setFkCustomer($this->castId($request->query->get('customer_id'))); - $this->getFacade() - ->setDefaultBillingAddress($addressTransfer); - - return $this->redirectResponse('/customer/profile?id=' . $this->castId($request->query->get('customer_id'))); - } -} From abd4059096e02ebd7e70c630d7cc0bab2f2f9f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Klatt?= Date: Mon, 23 Oct 2017 11:35:13 +0000 Subject: [PATCH 13/14] core-2141 removed dependencies in Testify --- tests/SprykerTest/Zed/Customer/codeception.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/SprykerTest/Zed/Customer/codeception.yml b/tests/SprykerTest/Zed/Customer/codeception.yml index e4611710..63119e24 100644 --- a/tests/SprykerTest/Zed/Customer/codeception.yml +++ b/tests/SprykerTest/Zed/Customer/codeception.yml @@ -41,4 +41,13 @@ suites: depends: \SprykerTest\Shared\Testify\Helper\ZedBootstrap - \SprykerTest\Shared\Testify\Helper\ZedBootstrap: depends: \SprykerTest\Shared\Testify\Helper\BundleConfig + serviceProvider: + - Spryker\Shared\Application\ServiceProvider\FormFactoryServiceProvider + - Spryker\Zed\Application\Communication\Plugin\ServiceProvider\MvcRoutingServiceProvider + - Spryker\Zed\Application\Communication\Plugin\ServiceProvider\RoutingServiceProvider + - Spryker\Zed\Application\Communication\Plugin\ServiceProvider\RequestServiceProvider + - Spryker\Zed\Application\Communication\Plugin\ServiceProvider\TranslationServiceProvider + - Spryker\Zed\Gui\Communication\Plugin\ServiceProvider\GuiTwigExtensionServiceProvider + - Spryker\Zed\Twig\Communication\Plugin\ServiceProvider\TwigServiceProvider + - Spryker\Zed\ZedNavigation\Communication\Plugin\ServiceProvider\ZedNavigationServiceProvider - \SprykerTest\Shared\Customer\Helper\CustomerDataHelper From 2d5d58accb5fa1b285fbba254ea2e125b1abe0b4 Mon Sep 17 00:00:00 2001 From: mscherer Date: Wed, 29 Nov 2017 16:43:18 +0100 Subject: [PATCH 14/14] Fix CS. --- .../Zed/Customer/Business/Anonymizer/CustomerAnonymizer.php | 3 +-- src/Spryker/Zed/Customer/Business/CustomerFacade.php | 4 ++-- src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Spryker/Zed/Customer/Business/Anonymizer/CustomerAnonymizer.php b/src/Spryker/Zed/Customer/Business/Anonymizer/CustomerAnonymizer.php index fba7a1d9..dd1d0fce 100644 --- a/src/Spryker/Zed/Customer/Business/Anonymizer/CustomerAnonymizer.php +++ b/src/Spryker/Zed/Customer/Business/Anonymizer/CustomerAnonymizer.php @@ -47,8 +47,7 @@ class CustomerAnonymizer implements CustomerAnonymizerInterface * @param array $customerAnonymizerPlugins */ public function __construct( - CustomerQueryContainerInterface - $customerQueryContainer, + CustomerQueryContainerInterface $customerQueryContainer, CustomerInterface $customerModel, AddressInterface $addressModel, array $customerAnonymizerPlugins diff --git a/src/Spryker/Zed/Customer/Business/CustomerFacade.php b/src/Spryker/Zed/Customer/Business/CustomerFacade.php index 20abc773..42a0c4fe 100644 --- a/src/Spryker/Zed/Customer/Business/CustomerFacade.php +++ b/src/Spryker/Zed/Customer/Business/CustomerFacade.php @@ -415,7 +415,7 @@ public function tryAuthorizeCustomerByEmailAndPassword(CustomerTransfer $custome */ public function saveCustomerForOrder( QuoteTransfer $quoteTransfer, - CheckoutResponseTransfer $checkoutResponseTransfer + CheckoutResponseTransfer $checkoutResponseTransfer ) { $this->getFactory()->createCustomerOrderSaver()->saveOrder($quoteTransfer, $checkoutResponseTransfer); } @@ -432,7 +432,7 @@ public function saveCustomerForOrder( */ public function checkOrderPreSaveConditions( QuoteTransfer $quoteTransfer, - CheckoutResponseTransfer $checkoutResponseTransfer + CheckoutResponseTransfer $checkoutResponseTransfer ) { $this->getFactory() ->createPreConditionChecker() diff --git a/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php b/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php index fe21470b..9f6ac213 100644 --- a/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php +++ b/src/Spryker/Zed/Customer/Business/CustomerFacadeInterface.php @@ -351,7 +351,7 @@ public function tryAuthorizeCustomerByEmailAndPassword(CustomerTransfer $custome */ public function saveCustomerForOrder( QuoteTransfer $quoteTransfer, - CheckoutResponseTransfer $checkoutResponseTransfer + CheckoutResponseTransfer $checkoutResponseTransfer ); /** @@ -367,7 +367,7 @@ public function saveCustomerForOrder( */ public function checkOrderPreSaveConditions( QuoteTransfer $quoteTransfer, - CheckoutResponseTransfer $checkoutResponseTransfer + CheckoutResponseTransfer $checkoutResponseTransfer ); /**