function initConfigLoader() { // We load other services from the definitions in config file // Simple load three config files (framework.yml, database.yml, application.yml) $loader = new ConfigLoader(); if (file_exists(PH_APP_ROOT . '/config/framework.yml')) { $loader->load('framework', PH_APP_ROOT . '/config/framework.yml'); } // This is for DatabaseService if (file_exists(PH_APP_ROOT . '/db/config/database.yml')) { $loader->load('database', PH_APP_ROOT . '/db/config/database.yml'); } elseif (file_exists(PH_APP_ROOT . '/config/database.yml')) { $loader->load('database', PH_APP_ROOT . '/config/database.yml'); } // Config for application, services does not depends on this config file. if (file_exists(PH_APP_ROOT . '/config/application.yml')) { $loader->load('application', PH_APP_ROOT . '/config/application.yml'); } // Only load testing configuration when environment // is 'testing' if (getenv('PHIFTY_ENV') === 'testing') { if (file_exists(PH_APP_ROOT . '/config/testing.yml')) { $loader->load('testing', ConfigCompiler::compile(PH_APP_ROOT . '/config/testing.yml')); } } return $loader; }
public function execute() { $configPath = func_get_args(); // should we scan config directories ? if (empty($configPath)) { $configPath = array_filter(array('config/application.yml', 'config/framework.yml', 'config/database.yml', 'config/testing.yml'), function ($file) { return file_exists($file); }); } if (empty($configPath)) { die("No config found."); } foreach ($configPath as $path) { $this->logger->info("Building config file {$path}"); ConfigCompiler::compile($path); } $this->logger->info('Done'); }