当前位置: 首页>>代码示例>>PHP>>正文


PHP ContainerBuilder::getParameter方法代码示例

本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::getParameter方法的具体用法?PHP ContainerBuilder::getParameter怎么用?PHP ContainerBuilder::getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\DependencyInjection\ContainerBuilder的用法示例。


在下文中一共展示了ContainerBuilder::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerFormThemes

 /**
  * Registers form resources for CKFinder form field types.
  *
  * @param ContainerBuilder $container
  */
 protected function registerFormThemes(ContainerBuilder $container)
 {
     $templatingEngines = $container->getParameter('templating.engines');
     if (in_array('twig', $templatingEngines)) {
         $container->setParameter('twig.form.resources', array_merge(array('CKSourceCKFinderBundle:Form:fields.html.twig'), $container->getParameter('twig.form.resources')));
     }
 }
开发者ID:ghoulaymen,项目名称:ckfinder-symfony2-bundle,代码行数:12,代码来源:CKSourceCKFinderExtension.php

示例2: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $container->setParameter('eo_airbrake.api_key', $config['api_key']);
     $container->setParameter('eo_airbrake.async', $config['async']);
     $container->setParameter('eo_airbrake.host', $config['host']);
     $container->setParameter('eo_airbrake.secure', $config['secure']);
     // Exception Listener
     if ($config['api_key']) {
         // Airbreak Configuration
         $class = $container->getParameter('eo_airbrake.configuration.class');
         $definition = new Definition($class, array($config['api_key'], $config['async'], $container->getParameter('kernel.environment'), $config['host'], $config['secure']));
         $container->setDefinition('eo_airbrake.configuration', $definition);
         // Airbreak Client
         $class = $container->getParameter('eo_airbrake.client.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.configuration')));
         $container->setDefinition('eo_airbrake.client', $definition);
         // Exception Listener
         $class = $container->getParameter('eo_airbrake.exception_listener.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.client'), $config['ignored_exceptions']));
         $definition->addTag('kernel.event_listener', array('event' => 'kernel.exception', 'method' => 'onKernelException'));
         $container->setDefinition('php_airbrake.exception_listener', $definition);
         // PHP Shutdown Listener
         $class = $container->getParameter('eo_airbrake.shutdown_listener.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.client')));
         $definition->addTag('kernel.event_listener', array('event' => 'kernel.controller', 'method' => 'register'));
         $container->setDefinition('php_airbrake.shutdown_listener', $definition);
     }
 }
开发者ID:Foild,项目名称:EoAirbrakeBundle,代码行数:35,代码来源:EoAirbrakeExtension.php

示例3: process

 public function process(ContainerBuilder $container)
 {
     $issuer = $container->getParameter('jwt_iss');
     $definition = $container->getDefinition('oauth2.server');
     $args = $definition->getArguments();
     $args['oauth2.server.storage'][] = new Reference('oauth2.storage.user_claims');
     $args['oauth2.server.storage'][] = new Reference('oauth2.storage.public_key');
     $args['oauth2.server.grant_types'] = array();
     $args['oauth2.server.response_types'] = array('token' => new Reference('oauth2.response_types.token'), 'code' => new Reference('oauth2.response_types.code'), 'id_token' => new Reference('oauth2.response_types.id_token'), 'id_token token' => new Reference('oauth2.response_types.id_token_token'), 'code id_token' => new Reference('oauth2.response_types.code_id_token'));
     $definition->setArguments($args);
     if ($container->hasDefinition('gaufrette.jwks_fs_filesystem')) {
         $filesystem = new Reference('gaufrette.jwks_fs_filesystem');
         $fileName = $container->getParameter('jwks_private_key_file');
         $container->getDefinition('oauth2.storage.public_key')->addMethodCall('setFilesystem', array($filesystem, $fileName));
     }
     if ($container->hasDefinition('oauth2.grant_type.authorization_code')) {
         $sessionState = new Reference('oidc.storage.session_state');
         $container->getDefinition('oauth2.grant_type.authorization_code')->addMethodCall('setSessionStateStorage', array($sessionState));
     }
     if ($container->hasDefinition('oauth2.storage.authorization_code')) {
         $sessionState = new Reference('oidc.storage.session_state');
         $container->getDefinition('oauth2.storage.authorization_code')->addMethodCall('setSessionStateStorage', array($sessionState));
     }
     if ($container->hasDefinition('oauth2.scope_manager')) {
         $scopes = $container->getParameter('lc_supported_scopes');
         $container->getDefinition('oauth2.scope_manager')->addMethodCall('setScopes', array($scopes));
     }
     if ($container->hasDefinition('oauth2.storage.access_token')) {
         $secret = $container->getParameter('secret');
         $container->getDefinition('oauth2.storage.access_token')->addMethodCall('setPairwiseSubjectIdSalt', array($secret));
     }
 }
开发者ID:redelivre,项目名称:login-cidadao,代码行数:32,代码来源:OverrideServiceCompilerPass.php

示例4: handle

 /**
  * {@inheritdoc}
  */
 public function handle()
 {
     $manifests = $this->container->getParameter('eva.directory.eva.manifests');
     require_once $manifests . '/vendor/autoload.php';
     $local = $this->container->get('eva.plug.finder.local');
     $local->find();
 }
开发者ID:eva,项目名称:eva,代码行数:10,代码来源:Kernel.php

示例5: registerResources

 protected function registerResources(ContainerBuilder $container)
 {
     $templatingEngines = $container->getParameter('templating.engines');
     if (in_array('twig', $templatingEngines)) {
         $container->setParameter('twig.form.resources', array_merge(array('FenrizbesFormConstructorBundle:Form:fields.html.twig'), $container->getParameter('twig.form.resources')));
     }
 }
开发者ID:it-blaster,项目名称:form-constructor-bundle,代码行数:7,代码来源:FenrizbesFormConstructorExtension.php

示例6: prepend

 public function prepend(ContainerBuilder $container)
 {
     $knpMenuConfig['twig'] = true;
     // set to false to disable the Twig extension and the TwigRenderer
     $knpMenuConfig['templating'] = false;
     // if true, enables the helper for PHP templates
     $knpMenuConfig['default_renderer'] = 'twig';
     // The renderer to use, list is also available by default
     $container->prependExtensionConfig('knp_menu', $knpMenuConfig);
     $fosUserConfig['db_driver'] = 'orm';
     // other valid values are 'mongodb', 'couchdb'
     $fosUserConfig['firewall_name'] = 'main';
     $fosUserConfig['user_class'] = 'Kunstmaan\\AdminBundle\\Entity\\User';
     $fosUserConfig['group']['group_class'] = 'Kunstmaan\\AdminBundle\\Entity\\Group';
     $fosUserConfig['resetting']['token_ttl'] = 86400;
     // Use this node only if you don't want the global email address for the resetting email
     $fosUserConfig['resetting']['email']['from_email']['address'] = 'admin@kunstmaan.be';
     $fosUserConfig['resetting']['email']['from_email']['sender_name'] = 'admin';
     $fosUserConfig['resetting']['email']['template'] = 'FOSUserBundle:Resetting:email.txt.twig';
     $fosUserConfig['resetting']['form']['type'] = 'fos_user_resetting';
     $fosUserConfig['resetting']['form']['name'] = 'fos_user_resetting_form';
     $fosUserConfig['resetting']['form']['validation_groups'] = ['ResetPassword'];
     $container->prependExtensionConfig('fos_user', $fosUserConfig);
     $monologConfig['handlers']['main']['type'] = 'rotating_file';
     $monologConfig['handlers']['main']['path'] = sprintf('%s/%s', $container->getParameter('kernel.logs_dir'), $container->getParameter('kernel.environment'));
     $monologConfig['handlers']['main']['level'] = 'debug';
     $container->prependExtensionConfig('monolog', $monologConfig);
     $configs = $container->getExtensionConfig($this->getAlias());
     $this->processConfiguration(new Configuration(), $configs);
 }
开发者ID:Amrit01,项目名称:KunstmaanBundlesCMS,代码行数:30,代码来源:KunstmaanAdminExtension.php

示例7: process

 public function process(ContainerBuilder $container)
 {
     if (!$container->hasDefinition('sonata.notification.dispatcher')) {
         return;
     }
     $definition = $container->getDefinition('sonata.notification.dispatcher');
     $informations = array();
     foreach ($container->findTaggedServiceIds('sonata.notification.consumer') as $id => $events) {
         foreach ($events as $event) {
             $priority = isset($event['priority']) ? $event['priority'] : 0;
             if (!isset($event['type'])) {
                 throw new \InvalidArgumentException(sprintf('Service "%s" must define the "type" attribute on "sonata.notification" tags.', $id));
             }
             if (!isset($informations[$event['type']])) {
                 $informations[$event['type']] = array();
             }
             $informations[$event['type']][] = $id;
             $definition->addMethodCall('addListenerService', array($event['type'], array($id, 'process'), $priority));
         }
     }
     $container->getDefinition('sonata.notification.consumer.metadata')->replaceArgument(0, $informations);
     if ($container->getParameter('sonata.notification.event.iteration_listeners')) {
         $ids = $container->getParameter('sonata.notification.event.iteration_listeners');
         foreach ($ids as $serviceId) {
             $definition = $container->getDefinition($serviceId);
             $class = new \ReflectionClass($definition->getClass());
             if (!$class->implementsInterface('Sonata\\NotificationBundle\\Event\\IterationListener')) {
                 throw new RuntimeException('Iteration listeners must implement Sonata\\NotificationBundle\\Event\\IterationListener');
             }
             $definition->addTag('kernel.event_listener', array('event' => IterateEvent::EVENT_NAME, 'method' => 'iterate'));
         }
     }
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:33,代码来源:NotificationCompilerPass.php

示例8: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $isInstalled = $container->getParameter('installed');
     $configValue = $container->getParameter('oro_cron.jms_statistics');
     $statisticEnabled = $isInstalled ? $configValue : false;
     $container->setParameter('jms_job_queue.statistics', $statisticEnabled);
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:JobStatisticParameterPass.php

示例9: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasDefinition($this->registryService) && !$container->hasAlias($this->registryService)) {
         return;
     }
     $customLogLevels = $container->getParameter('abc.job.logging.level');
     $registry = $container->findDefinition('abc.job.registry');
     foreach ($container->findTaggedServiceIds($this->jobTag) as $id => $tags) {
         $def = $container->getDefinition($id);
         if (!$def->isPublic()) {
             throw new \InvalidArgumentException(sprintf('The service "%s" must be public as jobs are lazy-loaded.', $id));
         }
         foreach ($tags as $tag) {
             if (!isset($tag['type'])) {
                 throw new \InvalidArgumentException(sprintf('Service "%s" must define the "type" attribute on "%s" tags.', $id, $this->jobTag));
             }
             if (!isset($tag['method'])) {
                 throw new \InvalidArgumentException(sprintf('Service "%s" must define the "method" attribute on "%s" tags.', $id, $this->jobTag));
             }
             $logLevel = isset($customLogLevels[$tag['type']]) ? $this->levelToMonologConst($customLogLevels[$tag['type']]) : null;
             $jobTypeId = 'abc.job.type.' . $tag['type'];
             $definition = $this->createType($id, $tag['type'], array(new Reference($id), $tag['method']), $logLevel);
             $container->setDefinition($jobTypeId, $definition);
             $registry->addMethodCall('register', array(new Reference($jobTypeId), true));
         }
     }
     // there as a reason this listener was registered here, what was it?
     if ($container->hasParameter('abc.job.adapter') && $container->getParameter('abc.job.adapter') == 'sonata') {
         $pass = new RegisterSonataListenersPass();
         $pass->process($container);
     }
 }
开发者ID:aboutcoders,项目名称:job-bundle,代码行数:35,代码来源:RegisterJobsPass.php

示例10: process

 public function process(ContainerBuilder $container)
 {
     $clearSpoolsId = 'long_running.swift_mailer.clear_spools';
     if (!$container->has($clearSpoolsId)) {
         return;
     }
     if (!$container->hasAlias('swiftmailer.mailer') || $container->getParameter('swiftmailer.mailers') === []) {
         return;
     }
     $spoolServiceReferences = [];
     $realTransportServiceReferences = [];
     $mailers = $container->getParameter('swiftmailer.mailers');
     foreach ($mailers as $name => $mailer) {
         if ($container->getParameter(sprintf('swiftmailer.mailer.%s.spool.enabled', $name))) {
             $transport = sprintf('swiftmailer.mailer.%s.transport', $name);
             $transportDefinition = $container->findDefinition($transport);
             if (is_a($transportDefinition->getClass(), 'Swift_Transport_SpoolTransport', true)) {
                 $spool = sprintf('swiftmailer.mailer.%s.spool', $name);
                 $spoolDefinition = $container->findDefinition($spool);
                 if (is_a($spoolDefinition->getClass(), 'Swift_MemorySpool', true)) {
                     $realTransport = sprintf('swiftmailer.mailer.%s.transport.real', $name);
                     $spoolServiceReferences[$name] = new Reference($spool);
                     $realTransportServiceReferences[$name] = new Reference($realTransport);
                 }
             }
         }
     }
     $definition = $container->getDefinition($clearSpoolsId);
     $definition->replaceArgument(0, $spoolServiceReferences);
     $definition->replaceArgument(1, $realTransportServiceReferences);
 }
开发者ID:cmodijk,项目名称:LongRunning,代码行数:31,代码来源:SwiftMailerPass.php

示例11: process

 /**
  * @inheritdoc
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasDefinition('qimnet.crud.configuration.repository')) {
         return;
     }
     $repository = $container->getDefinition('qimnet.crud.configuration.repository');
     $defaults = $container->getParameter('qimnet.crud.defaults');
     foreach ($container->getParameter('qimnet.crud.services') as $name => $configuration) {
         $options = $configuration['options'] + array('name' => $name) + $defaults['options'];
         $configuration = $configuration + $defaults;
         $serviceId = 'qimnet.crud.configuration.' . strtolower($name);
         $definition = new DefinitionDecorator('qimnet.crud.configuration');
         foreach (array('object_manager_factory', 'security_context_factory', 'path_generator_factory') as $index => $key) {
             if ($configuration[$key]) {
                 $definition->replaceArgument($index, new Reference($configuration[$key]));
             }
         }
         $definition->addArgument($options);
         if ($configuration['class']) {
             $definition->setClass($configuration['class']);
         }
         $definition->addTag('qimnet.crud.configuration', array('alias' => $name, 'object_class' => $options['object_class'], 'worker' => $configuration['worker'], 'redirection_manager' => $configuration['redirection_manager']));
         $container->setDefinition($serviceId, $definition);
     }
     $taggedServices = $container->findTaggedServiceIds('qimnet.crud.configuration');
     foreach ($taggedServices as $id => $attributes) {
         $repository->addMethodCall('add', array($attributes[0]['alias'], $attributes[0]['object_class'], $id, $attributes[0]['worker'], $attributes[0]['redirection_manager']));
     }
 }
开发者ID:qimnet,项目名称:crud-bundle,代码行数:32,代码来源:CRUDConfigurationCompilerPass.php

示例12: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration($container->getParameter('kernel.debug'));
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     if (true === $container->getParameter('kernel.debug')) {
         $loader->load('logger.xml');
     }
     if (isset($config['connections'])) {
         if (!isset($config['default_connection'])) {
             $keys = array_keys($config['connections']);
             $config['default_connection'] = reset($keys);
         }
         $loader->load('connection.xml');
         foreach ($config['connections'] as $name => $connection) {
             $arguments = array_merge(array($name), array_values($connection));
             $logger = new Reference('mop_arangodb.data_collector');
             if (true === $container->getParameter('kernel.debug')) {
                 $container->getDefinition('mop_arangodb.connection_factory')->addMethodCall('addLogger', array($logger));
             }
             $container->setDefinition('mop_arangodb.connections.' . $name, new DefinitionDecorator('mop_arangodb.connection'))->setArguments($arguments);
         }
     }
     if ($config['default_connection']) {
         $container->setAlias('mop_arangodb.default_connection', 'mop_arangodb.connections.' . $config['default_connection']);
     }
     if (isset($config['fos'])) {
         $container->setParameter('mop_arangodb.fos.collection', $config['fos']['collection']);
         $container->setAlias('mop_arangodb.fos.connection', 'mop_arangodb.connections.' . $config['fos']['connection']);
         $loader->load('fos.xml');
     }
 }
开发者ID:sandermarechal,项目名称:MopArangoDbBundle,代码行数:35,代码来源:MopArangoDbExtension.php

示例13: process

 /**
  * You can modify the container here before it is dumped to PHP code.
  *
  * @param ContainerBuilder $container
  *
  * @api
  */
 public function process(ContainerBuilder $container)
 {
     try {
         $chainRouter = $container->getDefinition("router.chainRequest");
     } catch (InvalidArgumentException $e) {
         return;
     }
     foreach ($container->findTaggedServiceIds("router.register") as $id => $attributes) {
         $priority = isset($attributes[0]["priority"]) ? $attributes[0]["priority"] : 0;
         $router = $container->getDefinition($id);
         $router->addMethodCall("setOption", array("matcher_cache_class", $container::camelize("ProjectUrlMatcher" . $id)));
         $router->addMethodCall("setOption", array("generator_cache_class", $container::camelize("ProjectUrlGenerator" . $id)));
         $chainRouter->addMethodCall("add", array(new Reference($id), $priority));
     }
     if (defined("THELIA_INSTALL_MODE") === false) {
         $modules = \Thelia\Model\ModuleQuery::getActivated();
         foreach ($modules as $module) {
             $moduleBaseDir = $module->getBaseDir();
             $routingConfigFilePath = $module->getAbsoluteBaseDir() . DS . "Config" . DS . "routing.xml";
             if (file_exists($routingConfigFilePath)) {
                 $definition = new Definition($container->getParameter("router.class"), array(new Reference("router.module.xmlLoader"), $routingConfigFilePath, array("cache_dir" => $container->getParameter("kernel.cache_dir"), "debug" => $container->getParameter("kernel.debug"), "matcher_cache_class" => $container::camelize("ProjectUrlMatcher" . $moduleBaseDir), "generator_cache_class" => $container::camelize("ProjectUrlGenerator" . $moduleBaseDir)), new Reference("request.context")));
                 $container->setDefinition("router." . $moduleBaseDir, $definition);
                 $chainRouter->addMethodCall("add", array(new Reference("router." . $moduleBaseDir), 150));
             }
         }
     }
 }
开发者ID:margery,项目名称:thelia,代码行数:34,代码来源:RegisterRouterPass.php

示例14: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasParameter('fos_user.storage')) {
         return;
     }
     $storage = $container->getParameter('fos_user.storage');
     if ('custom' === $storage) {
         return;
     }
     $validationFile = __DIR__ . '/../../Resources/config/validation/' . $storage . '.xml';
     if ($container->hasDefinition('validator.builder')) {
         // Symfony 2.5+
         $container->getDefinition('validator.builder')->addMethodCall('addXmlMapping', array($validationFile));
         return;
     }
     // Old method of loading validation
     if (!$container->hasParameter('validator.mapping.loader.xml_files_loader.mapping_files')) {
         return;
     }
     $files = $container->getParameter('validator.mapping.loader.xml_files_loader.mapping_files');
     if (is_file($validationFile)) {
         $files[] = realpath($validationFile);
         $container->addResource(new FileResource($validationFile));
     }
     $container->setParameter('validator.mapping.loader.xml_files_loader.mapping_files', $files);
 }
开发者ID:jjspider277,项目名称:weddings,代码行数:29,代码来源:ValidationPass.php

示例15: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     // add inference types
     $inferenceTypeContainer = $container->getDefinition('rezzza.ruler.inference_type_container');
     foreach ($container->findTaggedServiceIds('rezzza.ruler.inference_type') as $id => $tagAttributes) {
         $inferenceTypeContainer->addMethodCall('add', array(new Reference($id)));
     }
     // add events
     $eventDatas = $container->getParameter('rezzza.ruler.events');
     $eventContainer = $container->getDefinition('rezzza.ruler.event.container');
     $events = array();
     foreach ($eventDatas as $key => $data) {
         $event = new Definition('Rezzza\\RulerBundle\\Ruler\\Event\\Event', array($key, $data['label'], $data['context_builder']));
         $events[$key] = $event;
         $eventContainer->addMethodCall('add', array($event));
     }
     // add inferences
     $inferenceDatas = $container->getParameter('rezzza.ruler.inferences');
     $inferenceContainer = $container->getDefinition('rezzza.ruler.inference_container');
     foreach ($inferenceDatas as $key => $data) {
         $inference = new Definition('Rezzza\\RulerBundle\\Ruler\\Inference\\Inference', array($key, $data['type'], $data['description'], $data['event']));
         foreach ($data['event'] as $event) {
             if (!isset($events[$event])) {
                 throw new \LogicException(sprintf('Event "%s" is not defined', $event));
             }
             $events[$event]->addMethodCall('addInference', array($inference));
         }
         $inferenceContainer->addMethodCall('add', array($inference));
     }
     /* --- functions --- */
     $rulerDefinition = $container->getDefinition('rezzza.ruler');
     foreach ($container->findTaggedServiceIds('rezzza.ruler.functions') as $id => $tagAttributes) {
         $rulerDefinition->addMethodCall('addFunctionCollection', array(new Reference($id)));
     }
 }
开发者ID:kmoussouni,项目名称:RulerBundle,代码行数:38,代码来源:BuilderCompilerPass.php


注:本文中的Symfony\Component\DependencyInjection\ContainerBuilder::getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。