From 528b8ad658fa6e13882e3749020d33ca005f535b Mon Sep 17 00:00:00 2001 From: Florent Chaintreuil Date: Fri, 5 Apr 2019 17:21:52 +0200 Subject: [PATCH 1/4] FrontendCustomerUserFormProvider : overriding is easier with static:: --- .../FrontendCustomerUserFormProvider.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php index 32c5130f8..46c1fde5d 100644 --- a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php +++ b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php @@ -51,7 +51,7 @@ public function getCustomerUserForm(CustomerUser $customerUser) */ public function getForgotPasswordFormView(array $options = []) { - $options['action'] = $this->generateUrl(self::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); + $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); return $this->getFormView(CustomerUserPasswordRequestType::class, null, $options); } @@ -63,7 +63,7 @@ public function getForgotPasswordFormView(array $options = []) */ public function getForgotPasswordForm(array $options = []) { - $options['action'] = $this->generateUrl(self::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); + $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); return $this->getForm(CustomerUserPasswordRequestType::class, null, $options); } @@ -75,7 +75,7 @@ public function getForgotPasswordForm(array $options = []) */ public function getResetPasswordFormView(CustomerUser $customerUser = null) { - $options['action'] = $this->generateUrl(self::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getFormView(CustomerUserPasswordResetType::class, $customerUser, $options); } @@ -87,7 +87,7 @@ public function getResetPasswordFormView(CustomerUser $customerUser = null) */ public function getResetPasswordForm(CustomerUser $customerUser = null) { - $options['action'] = $this->generateUrl(self::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getForm(CustomerUserPasswordResetType::class, $customerUser, $options); } @@ -125,14 +125,18 @@ private function getCustomerUserFormOptions(CustomerUser $customerUser) { $options = []; + if (isset($options['action'])) { + return $options; + } + if ($customerUser->getId()) { $options['action'] = $this->generateUrl( - self::ACCOUNT_USER_UPDATE_ROUTE_NAME, + static::ACCOUNT_USER_UPDATE_ROUTE_NAME, ['id' => $customerUser->getId()] ); } else { $options['action'] = $this->generateUrl( - self::ACCOUNT_USER_CREATE_ROUTE_NAME + static::ACCOUNT_USER_CREATE_ROUTE_NAME ); } @@ -147,9 +151,14 @@ private function getCustomerUserFormOptions(CustomerUser $customerUser) private function getProfilerFormOptions(CustomerUser $customerUser) { $options = []; + + if (isset($options['action'])) { + return $options; + } + if ($customerUser->getId()) { $options['action'] = $this->generateUrl( - self::ACCOUNT_USER_PROFILE_UPDATE_ROUTE_NAME, + static::ACCOUNT_USER_PROFILE_UPDATE_ROUTE_NAME, ['id' => $customerUser->getId()] ); From 77804597750758cdcfc230193217b189415ec151 Mon Sep 17 00:00:00 2001 From: Florent Chaintreuil Date: Mon, 8 Apr 2019 10:00:55 +0200 Subject: [PATCH 2/4] Delete after anyt review --- .../DataProvider/FrontendCustomerUserFormProvider.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php index 46c1fde5d..1964b6cc4 100644 --- a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php +++ b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php @@ -125,10 +125,6 @@ private function getCustomerUserFormOptions(CustomerUser $customerUser) { $options = []; - if (isset($options['action'])) { - return $options; - } - if ($customerUser->getId()) { $options['action'] = $this->generateUrl( static::ACCOUNT_USER_UPDATE_ROUTE_NAME, @@ -152,10 +148,6 @@ private function getProfilerFormOptions(CustomerUser $customerUser) { $options = []; - if (isset($options['action'])) { - return $options; - } - if ($customerUser->getId()) { $options['action'] = $this->generateUrl( static::ACCOUNT_USER_PROFILE_UPDATE_ROUTE_NAME, From b0519e3eeb9b0645585bbc54ac9eae945bf2c133 Mon Sep 17 00:00:00 2001 From: Florent Chaintreuil Date: Wed, 10 Apr 2019 11:15:56 +0200 Subject: [PATCH 3/4] Fix after review --- .../DataProvider/FrontendCustomerUserFormProvider.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php index 1964b6cc4..147cf0af0 100644 --- a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php +++ b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php @@ -51,7 +51,7 @@ public function getCustomerUserForm(CustomerUser $customerUser) */ public function getForgotPasswordFormView(array $options = []) { - $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); + $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); return $this->getFormView(CustomerUserPasswordRequestType::class, null, $options); } @@ -63,7 +63,7 @@ public function getForgotPasswordFormView(array $options = []) */ public function getForgotPasswordForm(array $options = []) { - $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); + $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME); return $this->getForm(CustomerUserPasswordRequestType::class, null, $options); } @@ -75,7 +75,7 @@ public function getForgotPasswordForm(array $options = []) */ public function getResetPasswordFormView(CustomerUser $customerUser = null) { - $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getFormView(CustomerUserPasswordResetType::class, $customerUser, $options); } @@ -87,7 +87,7 @@ public function getResetPasswordFormView(CustomerUser $customerUser = null) */ public function getResetPasswordForm(CustomerUser $customerUser = null) { - $options['action'] = isset($options['action']) ?: $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getForm(CustomerUserPasswordResetType::class, $customerUser, $options); } From 8df6902946237b647d32030581c9301edebdd538 Mon Sep 17 00:00:00 2001 From: Florent Chaintreuil Date: Wed, 17 Apr 2019 15:36:31 +0200 Subject: [PATCH 4/4] Fix after review --- .../Layout/DataProvider/FrontendCustomerUserFormProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php index 147cf0af0..1a96b5be5 100644 --- a/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php +++ b/src/Oro/Bundle/CustomerBundle/Layout/DataProvider/FrontendCustomerUserFormProvider.php @@ -75,7 +75,7 @@ public function getForgotPasswordForm(array $options = []) */ public function getResetPasswordFormView(CustomerUser $customerUser = null) { - $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getFormView(CustomerUserPasswordResetType::class, $customerUser, $options); } @@ -87,7 +87,7 @@ public function getResetPasswordFormView(CustomerUser $customerUser = null) */ public function getResetPasswordForm(CustomerUser $customerUser = null) { - $options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); + $options['action'] = $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME); return $this->getForm(CustomerUserPasswordResetType::class, $customerUser, $options); }