From dc69e175dc95befc3e1c0eb1b9d51c23a0e1e0e9 Mon Sep 17 00:00:00 2001 From: Magento EngCom Team Date: Wed, 24 Jan 2018 12:10:20 -0600 Subject: [PATCH] :arrow_double_up: Forwardport of magento/magento2#12120 to 2.3-develop branch Applied pull request patch https://github.com/magento/magento2/pull/12120.patch (created by @hewersonfreitas) based on commit(s): 1. dd40f2b799381aa8475815774344eb4771920bef --- .../Eav/Model/Entity/Attribute/Backend/AbstractBackend.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php index fab2ed182f30e..206bff163f201 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php @@ -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() @@ -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)); } }