Skip to content

Commit 2b02b8b

Browse files
committed
MAGETWO-86545: [Backport 2.3-develop] Handle multiple errors in customer address validation when shown in adminhtml customer edit page #12937
- Merge Pull Request #12937 from adrian-martinez-interactiv4/magento2:FR23#ADMINHTML-CUSTOMER-SAVE-MULTIPLE-ERROR-MESSAGES - Merged commits: 1. 19fbeee
2 parents e150a7e + 19fbeee commit 2b02b8b

File tree

1 file changed

+12
-0
lines changed
  • app/code/Magento/Customer/Controller/Adminhtml/Index

1 file changed

+12
-0
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Magento\Customer\Model\Metadata\Form;
1414
use Magento\Framework\Exception\LocalizedException;
1515

16+
/**
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
*/
1619
class Save extends \Magento\Customer\Controller\Adminhtml\Index
1720
{
1821
/**
@@ -268,6 +271,15 @@ public function execute()
268271
$this->_addSessionErrorMessages($messages);
269272
$this->_getSession()->setCustomerFormData($originalRequestData);
270273
$returnToEdit = true;
274+
} catch (\Magento\Framework\Exception\AbstractAggregateException $exception) {
275+
$errors = $exception->getErrors();
276+
$messages = [];
277+
foreach ($errors as $error) {
278+
$messages[] = $error->getMessage();
279+
}
280+
$this->_addSessionErrorMessages($messages);
281+
$this->_getSession()->setCustomerFormData($originalRequestData);
282+
$returnToEdit = true;
271283
} catch (LocalizedException $exception) {
272284
$this->_addSessionErrorMessages($exception->getMessage());
273285
$this->_getSession()->setCustomerFormData($originalRequestData);

0 commit comments

Comments
 (0)