Skip to content

Commit 3e066db

Browse files
committed
Backport 2.2 - Don't set a source model on the attribute when it's not needed. This avoids accidentally persisting the source model to the database when using multiselect attributes.
(cherry picked from commit 477ca51)
1 parent c34ced3 commit 3e066db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,11 @@ public function getSource()
594594
{
595595
if (empty($this->_source)) {
596596
if (!$this->getSourceModel()) {
597-
$this->setSourceModel($this->_getDefaultSourceModel());
597+
$this->_source = $this->_getDefaultSourceModel();
598+
} else {
599+
$this->_source = $this->getSourceModel();
598600
}
599-
$source = $this->_universalFactory->create($this->getSourceModel());
601+
$source = $this->_universalFactory->create($this->_source);
600602
if (!$source) {
601603
throw new LocalizedException(
602604
__(

0 commit comments

Comments
 (0)