/** * Configure the application, or more specifically the dependency injection container. * * This method is invoked during configuration phase after all `::configure()` methods of all * modules have been invoked. * * Any configuration of services, parameters, etc. should be done in this method. * * Note, that after the application has been configured once and the container has been * cached, this method will not be invoked until the cache is cleared. Therefore, * any configuration to the container should be made in a way that is cacheable, ie. * static definitions of services (no use of object or closure services). * * By default, this method will attempt to load three files from `%config_dir%`: * * - `parameters.yml`, * - `parameters.{env}.yml`, * - `services.yml`; * * where `{env}` is the name of the current environment. * * None of these files needs to exist. * * If you are overwriting this method it is advisable to call the parent at one point, * unless you are perfectly sure what you are doing. */ public function configure() { // copy config values to the container $config = $this->getConfig(); $this->container->setParameter('log_file', $config->get('log_file')); $this->container->setParameter('log_level', $config->get('log_level')); $this->container->setParameter('cache.enabled', $config->get('cache.enabled')); $this->container->setParameter('cache.default_store', '@' . ltrim($config->get('cache.default_store'), '@')); $configDir = rtrim($this->container->getParameter('config_dir'), '/') . '/'; foreach (array('parameters.yml', 'parameters.' . $this->container->getParameter('env') . '.yml', 'services.yml') as $file) { try { $this->container->loadFromFile($configDir . $file); } catch (NotFoundException $e) { } } }