Skip to content

Commit 8747deb

Browse files
committed
MAGETWO-80426: Calling the getCustomAttributes() method on a product instance before it is saved, internal _data property structure is changed and extracted incorrectly before saved
1 parent 3d9a21c commit 8747deb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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)