/** * @param InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return int|void */ protected function execute(InputInterface $input, OutputInterface $output) { $searchPath = $input->getArgument('path'); if (substr($input->getArgument('path'), -1, 1) === '/') { $searchPath .= '*'; } $this->_collection->addFieldToFilter('path', array('like' => str_replace('*', '%', $searchPath))); if ($scopeId = $input->getOption('scope')) { $this->_collection->addFieldToFilter('scope', array('eq' => $scopeId)); } if ($scopeId = $input->getOption('scope-id')) { $this->_collection->addFieldToFilter('scope_id', array('eq' => $scopeId)); } $this->_collection->addOrder('path', 'ASC'); // sort according to the config overwrite order // trick to force order default -> (f)website -> store , because f comes after d and before s $this->_collection->addOrder('REPLACE(scope, "website", "fwebsite")', 'ASC'); $this->_collection->addOrder('scope_id', 'ASC'); if ($this->_collection->count() == 0) { $output->writeln(sprintf("Couldn't find a config value for \"%s\"", $input->getArgument('path'))); return; } foreach ($this->_collection as $item) { $table[] = array('path' => $item->getPath(), 'scope' => $item->getScope(), 'scope_id' => $item->getScopeId(), 'value' => $this->_formatValue($item->getValue(), $input->getOption('decrypt') ? 'decrypt' : false)); } ksort($table); if ($input->getOption('update-script')) { $this->renderAsUpdateScript($output, $table); } elseif ($input->getOption('magerun-script')) { $this->renderAsMagerunScript($output, $table); } else { $this->renderAsTable($output, $table, $input->getOption('format')); } }
/** * @inheritDoc */ protected function _afterLoad() { foreach ($this->_items as $item) { $item->setData('value', $this->valueProcessor->process($item->getData('value'), $this->getData('scope'), $this->getData('scope_id'), $item->getData('path'))); } parent::_afterLoad(); }