Skip to content

Commit

Permalink
MAGETWO-84272: Update AbstractBackend.php #12120
Browse files Browse the repository at this point in the history
 - fixed failed tests
  • Loading branch information
Oleksii Korshenko authored and ishakhsuvarov committed Feb 7, 2018
1 parent 5d084ce commit d248f4e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ public function validate($object)
$attribute = $this->getAttribute();
$attrCode = $attribute->getAttributeCode();
$value = $object->getData($attrCode);
$label = $attribute->getFrontend()->getLabel();

if ($attribute->getIsVisible()
&& $attribute->getIsRequired()
&& $attribute->isValueEmpty($value)
&& $attribute->isValueEmpty($attribute->getDefaultValue())
) {
$label = $attribute->getFrontend()->getLabel();
throw new LocalizedException(__('The value of attribute "%1" must be set', $label));
}

Expand All @@ -250,6 +250,7 @@ public function validate($object)

if ($attribute->getIsUnique()) {
if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) {
$label = $attribute->getFrontend()->getLabel();
throw new LocalizedException(__('The value of attribute "%1" must be unique', $label));
}
}
Expand Down

0 comments on commit d248f4e

Please sign in to comment.