/** * Configures the module. */ public function configure() { parent::configure(); $config = $this->getConfig(); foreach (['source', 'namespace', 'templates', 'output_dir', 'verbose'] as $key) { $this->container->setParameter('docs.' . $key, $config->get($key)); } $this->container->setParameter('docs.source', $config->get('source')); }
/** * Configures the module. */ public function configure() { parent::configure(); $config = $this->getConfig(); $this->container->setParameter('blog.data_file', $config->get('data_file')); $this->container->setParameter('blog.articles_dir', $config->get('articles_dir')); $this->container->setParameter('blog.template', $config->get('template')); $this->container->setParameter('blog.target_dir', $config->get('target_dir')); }
public function configure() { parent::configure(); $config = $this->getConfig(); $container = $this->getContainer(); // copy some params from config to container $this->container->setParameter('form.simple_handler.http_code_key', $config->get('ajax.json.http_code_key')); $this->container->setParameter('filestorage.simple.parent_dir', $config->get('filestorage.simple.web') ? '%web_dir%' : '%root_dir%'); $this->container->setParameter('filestorage.simple.dir', $config->get('filestorage.simple.dir')); // conditional configurations if ($config->get('router.use_request')) { $this->configureRouterRequestConfigurator(); } if ($config->get('ajax.enable')) { $this->configureAjax(); } if ($config->get('databridge.enable')) { $this->configureDataBridge(); } if ($config->get('mailer.enable')) { $this->configureMailer(); } }
/** * This method is called on the module during configuration phase so you can register any services, * listeners etc here. * * It should not contain any logic, just wiring things together. * * If the module contains any routes they should be registered here. */ public function configure() { parent::configure(); }
/** * Configures a module in context of the given application. * * @param AbstractModule $module Module to be configured. * @param AbstractApplication $application Application for which this module should be configured. * @param string $env [optional] Environment in which the application is running. Default: `dev`. * @param boolean $debug [optional] Debug mode status for the application. Default: `true`. */ public function configureModule(AbstractModule $module, AbstractApplication $application, $env = 'dev', $debug = true) { $container = $application->getContainer(); $config = $application->getConfig(); // define config for the module $container->register('config.' . $module->getName(), array('extends' => 'config_module.abstract')); // add method calls to load appropriate config files to the definition $configDefinition = $container->getDefinition('config.' . $module->getName()); $configDir = rtrim($module->getConfigDir(), DS); $configFiles = array_merge(FilesystemUtils::glob($configDir . '/config.{yml,yaml,php}', GLOB_BRACE), FilesystemUtils::glob($configDir . '/config.' . $env . '.{yml,yaml,php}', GLOB_BRACE)); foreach ($configFiles as $file) { $configDefinition->addMethodCall('loadFromFile', array($file)); } // add method call to apply the config from the application config $configDefinition->addMethodCall('apply', array($config->getNamespace($module->getName()))); // let it configure itself $module->configure(); }