Skip to content

Commit a247a3d

Browse files
authored
Optimize validation
Optimize validation when ShouldIgnoreValidation set `true`
1 parent eb31731 commit a247a3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ public function getDataModel($defaultBillingAddressId = null, $defaultShippingAd
566566
*/
567567
public function validate()
568568
{
569+
if ($this->getShouldIgnoreValidation()) {
570+
return true;
571+
}
572+
569573
$errors = [];
570574
if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
571575
$errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']);
@@ -627,7 +631,7 @@ public function validate()
627631
$errors[] = __('%fieldName is a required field.', ['fieldName' => 'regionId']);
628632
}
629633

630-
if (empty($errors) || $this->getShouldIgnoreValidation()) {
634+
if (empty($errors)) {
631635
return true;
632636
}
633637
return $errors;

0 commit comments

Comments
 (0)