Skip to content

Commit 5af4173

Browse files
author
David Freiman
committed
Add customer_validate event to try to minimize need for rewrites when customer validation is required
dispatch customer_validate event and pass the errors array so it can be modified by custom validators and passed back into the function
1 parent ffda2eb commit 5af4173

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/code/Magento/Customer/Model/Customer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,12 @@ public function validate()
10341034
$errors[] = __('Gender is required.');
10351035
}
10361036

1037+
$transport = new \Magento\Framework\Object(
1038+
['errors' => $errors]
1039+
);
1040+
$this->_eventManager->dispatch('customer_validate' , ['customer' => $this, 'transport' => $transport]);
1041+
$errors = $transport->getErrors();
1042+
10371043
if (empty($errors)) {
10381044
return true;
10391045
}

0 commit comments

Comments
 (0)