Skip to content

Commit

Permalink
MAGETWO-71200: Optimize validation #10381
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii Korshenko authored Jul 31, 2017
2 parents eb31731 + f17be38 commit 22d2489
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/code/Magento/Customer/Model/Address/AbstractAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ public function getDataModel($defaultBillingAddressId = null, $defaultShippingAd
*/
public function validate()
{
if ($this->getShouldIgnoreValidation()) {
return true;
}

$errors = [];
if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
$errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']);
Expand Down Expand Up @@ -627,7 +631,7 @@ public function validate()
$errors[] = __('%fieldName is a required field.', ['fieldName' => 'regionId']);
}

if (empty($errors) || $this->getShouldIgnoreValidation()) {
if (empty($errors)) {
return true;
}
return $errors;
Expand Down

0 comments on commit 22d2489

Please sign in to comment.