Example #1
0
 /**
  * @param DebugBar|null $debugBar
  * @param Config|null $config
  * @return $this
  */
 public function addConfig(DebugBar $debugBar = null, Config $config = null)
 {
     if (null === $debugBar) {
         return $this;
     }
     $debugBar->addCollector(new \DebugBar\DataCollector\ConfigCollector($config->all()));
     return $this;
 }
 /**
  * @param Input $input
  * @param Output $output
  * @return int
  */
 public function execute(Input $input, Output $output)
 {
     $kernel = $this->getContainer()->get('kernel');
     $config = new Config();
     $prod = $kernel->getRootPath() . '/config/config_prod.php';
     if (file_exists($prod)) {
         $config->load($prod);
     }
     foreach ($kernel->getBundles() as $bundle) {
         $bundle->registerConfiguration($config, AppKernel::ENV_PROD);
     }
     $caching = $kernel->getRootPath() . DIRECTORY_SEPARATOR . ConfigCacheCommand::CACHE_NAME;
     file_put_contents($caching, '<?php return ' . var_export($config->all(), true) . ';');
     $output->writeln('Caching to ' . $caching . '...... <success>[OK]</success>');
 }
Example #3
0
 /**
  * Register application configuration
  *
  * @param \FastD\Config\Config
  * @return void
  */
 public function registerConfiguration(\FastD\Config\Config $config)
 {
     $config->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.php');
 }
Example #4
0
 /**
  * Register bundle configuration.
  *
  * @param Config $config
  * @param string $env
  * @return void
  */
 public function registerConfiguration(Config $config, $env)
 {
     $config->load($this->getRootPath() . '/Resources/config/config_' . $env . '.php');
 }