Skip to content

Commit 47e0773

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-90336' into 2.3-develop-pr14
2 parents 7ce9cd7 + 5207fd8 commit 47e0773

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
@@ -468,7 +468,7 @@ public function testGetCustomAttributes()
468468
);
469469

470470
//Change the attribute value, should reflect in getCustomAttribute
471-
$this->category->setData($customAttributeCode, $newCustomAttributeValue);
471+
$this->category->setCustomAttribute($customAttributeCode, $newCustomAttributeValue);
472472
$this->assertEquals(1, count($this->category->getCustomAttributes()));
473473
$this->assertNotNull($this->category->getCustomAttribute($customAttributeCode));
474474
$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
@@ -1305,7 +1305,7 @@ public function testGetCustomAttributes()
13051305
);
13061306

13071307
//Change the attribute value, should reflect in getCustomAttribute
1308-
$this->model->setData($customAttributeCode, $newCustomAttributeValue);
1308+
$this->model->setCustomAttribute($customAttributeCode, $newCustomAttributeValue);
13091309
$this->assertEquals(1, count($this->model->getCustomAttributes()));
13101310
$this->assertNotNull($this->model->getCustomAttribute($customAttributeCode));
13111311
$this->assertEquals(

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)