Author: Romain Ruaud (romain.ruaud@smile.fr)
Inheritance: implements Magento\Framework\App\Config\Scope\ReaderInterface
Example #1
0
 /**
  * Read configuration by code
  *
  * @param null|string $code The container code
  *
  * @return array
  */
 public function read($code = null)
 {
     list($containerCode, $storeId) = explode("|", $code);
     $store = $this->storeManager->getStore($storeId);
     $config = array_replace_recursive($this->containerReader->read($containerCode), $this->initialConfig->getData("{$containerCode}|{$store->getCode()}"));
     $collection = $this->collectionFactory->create(['scope' => ContainerScopeInterface::SCOPE_STORE_CONTAINERS, 'scopeCode' => $code]);
     $dbStoreConfig = [];
     foreach ($collection as $item) {
         $dbStoreConfig[$item->getPath()] = $item->getValue();
     }
     $dbStoreConfig = $this->converter->convert($dbStoreConfig);
     $config = array_replace_recursive($config, $dbStoreConfig);
     return $config;
 }