From 3e066db75e495f96d264bf1347b9fec01a44032e Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Tue, 25 Sep 2018 19:57:09 +0200 Subject: [PATCH] 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 477ca51d052464e862301d945c8bb3550b6fa829) --- .../Eav/Model/Entity/Attribute/AbstractAttribute.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 0f3a1f2220644..65b60be0d96fd 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -594,9 +594,11 @@ public function getSource() { if (empty($this->_source)) { if (!$this->getSourceModel()) { - $this->setSourceModel($this->_getDefaultSourceModel()); + $this->_source = $this->_getDefaultSourceModel(); + } else { + $this->_source = $this->getSourceModel(); } - $source = $this->_universalFactory->create($this->getSourceModel()); + $source = $this->_universalFactory->create($this->_source); if (!$source) { throw new LocalizedException( __(