Skip to content

Commit

Permalink
⏫ Forwardport of #12120 to 2.3-develop branch
Browse files Browse the repository at this point in the history
Applied pull request patch https://github.com/magento/magento2/pull/12120.patch (created by @hewersonfreitas) based on commit(s):
  1. dd40f2b
  • Loading branch information
magento-engcom-team committed Jan 24, 2018
1 parent 8e77e2f commit dc69e17
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,14 @@ 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())
) {
throw new LocalizedException(__('The value of attribute "%1" must be set', $attrCode));
throw new LocalizedException(__('The value of attribute "%1" must be set', $label));
}

if ($attribute->getIsUnique()
Expand All @@ -248,8 +249,7 @@ public function validate($object)
}

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

0 comments on commit dc69e17

Please sign in to comment.