Skip to content

Commit

Permalink
Fixed problem during fresh installation fixes #8
Browse files Browse the repository at this point in the history
As the newly installed attributes are not available immediately we have to refresh the cache manually during the setup
  • Loading branch information
sydekumf authored Mar 20, 2017
1 parent 228d9ea commit da344b2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Setup/InstallData.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,29 @@ class InstallData implements InstallDataInterface
*/
protected $_configResource;

/**
* @var \Magento\Eav\Model\Config
*/
protected $_eavConfig;

/**
* Constructor
*
* @param \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory
* @param \Magento\Catalog\Api\ProductAttributeOptionManagementInterface $productAttributeOptionManagementInterface
* @param \Magento\Config\Model\ResourceModel\Config $configResource
* @param \Magento\Eav\Model\Config $eavConfig
*/
public function __construct(
\Magento\Eav\Setup\EavSetupFactory $eavSetupFactory,
\Magento\Catalog\Api\ProductAttributeOptionManagementInterface $productAttributeOptionManagementInterface,
\Magento\Config\Model\ResourceModel\Config $configResource
\Magento\Config\Model\ResourceModel\Config $configResource,
\Magento\Eav\Model\Config $eavConfig
){
$this->_eavSetupFactory = $eavSetupFactory;
$this->_productAttributeOptionManagementInterface = $productAttributeOptionManagementInterface;
$this->_configResource = $configResource;
$this->_eavConfig = $eavConfig;
}

/**
Expand Down Expand Up @@ -153,6 +161,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
]);
}

// clean cache so that newly created attributes will be loaded from database
$this->_eavConfig->clear();
$this->_setSystemConfiguration();
}

Expand Down Expand Up @@ -269,4 +279,4 @@ protected function _setSystemConfiguration()
0
);
}
}
}

0 comments on commit da344b2

Please sign in to comment.