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)
 {
     $config = array_replace_recursive($this->defaultReader->read(ContainerScopeInterface::SCOPE_DEFAULT), $this->initialConfig->getData($code));
     $collection = $this->collectionFactory->create(['scope' => ContainerScopeInterface::SCOPE_CONTAINERS, 'scopeCode' => $code]);
     $dbContainerConfig = [];
     foreach ($collection as $item) {
         $dbContainerConfig[$item->getPath()] = $item->getValue();
     }
     $dbContainerConfig = $this->converter->convert($dbContainerConfig);
     if (count($dbContainerConfig)) {
         $config = array_replace_recursive($config, $dbContainerConfig);
     }
     return $config;
 }