Skip to content

Commit 75f3c91

Browse files
committed
Merge branch 'MAGETWO-80426' into 2.1.13-PR-0.4
2 parents c1b7710 + a30c06b commit 75f3c91

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ public function testGetCustomAttributes()
550550
$this->assertEquals("description", $this->category->getCustomAttribute($descriptionAttributeCode)->getValue());
551551

552552
//Change the attribute value, should reflect in getCustomAttribute
553-
$this->category->setData($descriptionAttributeCode, "new description");
553+
$this->category->setCustomAttribute($descriptionAttributeCode, "new description");
554554
$this->assertEquals(1, count($this->category->getCustomAttributes()));
555555
$this->assertNotNull($this->category->getCustomAttribute($descriptionAttributeCode));
556556
$this->assertEquals(

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ public function testGetCustomAttributes()
12471247
$this->assertEquals("red", $this->model->getCustomAttribute($colorAttributeCode)->getValue());
12481248

12491249
//Change the attribute value, should reflect in getCustomAttribute
1250-
$this->model->setData($colorAttributeCode, "blue");
1250+
$this->model->setCustomAttribute($colorAttributeCode, "blue");
12511251
$this->assertEquals(1, count($this->model->getCustomAttributes()));
12521252
$this->assertNotNull($this->model->getCustomAttribute($colorAttributeCode));
12531253
$this->assertEquals("blue", $this->model->getCustomAttribute($colorAttributeCode)->getValue());

lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ protected function initializeCustomAttributes()
113113
$customAttributeCodes = $this->getCustomAttributesCodes();
114114

115115
foreach ($customAttributeCodes as $customAttributeCode) {
116-
if (isset($this->_data[$customAttributeCode])) {
116+
if (isset($this->_data[self::CUSTOM_ATTRIBUTES][$customAttributeCode])) {
117+
$customAttribute = $this->customAttributeFactory->create()
118+
->setAttributeCode($customAttributeCode)
119+
->setValue($this->_data[self::CUSTOM_ATTRIBUTES][$customAttributeCode]->getValue());
120+
$customAttributes[$customAttributeCode] = $customAttribute;
121+
} elseif (isset($this->_data[$customAttributeCode])) {
117122
$customAttribute = $this->customAttributeFactory->create()
118123
->setAttributeCode($customAttributeCode)
119124
->setValue($this->_data[$customAttributeCode]);

0 commit comments

Comments
 (0)