Skip to content

Commit 0788e64

Browse files
author
Joan He
committed
MAGETWO-71708: [Staging] Cannot create staging update for product with unique attribute in set
1 parent 65cc2b7 commit 0788e64

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,8 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
887887
$select = $connection->select();
888888

889889
$entityIdField = $this->getEntityIdField();
890-
if ($attribute->getBackend()->getType() === 'static') {
890+
$attributeBackend = $attribute->getBackend();
891+
if ($attributeBackend->getType() === 'static') {
891892
$value = $object->getData($attribute->getAttributeCode());
892893
$bind = ['value' => trim($value)];
893894

@@ -899,18 +900,17 @@ public function checkAttributeUniqueValue(AbstractAttribute $attribute, $object)
899900
);
900901
} else {
901902
$value = $object->getData($attribute->getAttributeCode());
902-
if ($attribute->getBackend()->getType() == 'datetime') {
903+
if ($attributeBackend->getType() == 'datetime') {
903904
$value = (new \DateTime($value))->format('Y-m-d H:i:s');
904905
}
905906
$bind = [
906907
'attribute_id' => $attribute->getId(),
907908
'value' => trim($value),
908909
];
909910

910-
$backend = $attribute->getBackend();
911-
$entityIdField = $backend->getEntityIdField();
911+
$entityIdField = $attributeBackend->getEntityIdField();
912912
$select->from(
913-
$backend->getTable(),
913+
$attributeBackend->getTable(),
914914
$entityIdField
915915
)->where(
916916
'attribute_id = :attribute_id'

0 commit comments

Comments
 (0)