From 477ca51d052464e862301d945c8bb3550b6fa829 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Tue, 25 Sep 2018 19:57:09 +0200 Subject: [PATCH] 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. --- .../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 6601c05051378..88037448b5503 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -608,9 +608,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( __(