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


PHP ContainerBuilder::getExtensionConfigs方法代码示例

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


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

示例1: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $classes = array();
     foreach ($container->getExtensionConfigs() as $name => $configs) {
         list($namespace, $tag) = explode(':', $name);
         $extension = $container->getExtension($namespace);
         if ($extension instanceof Extension) {
             $classes = array_merge($classes, $extension->getClassesToCompile());
         }
     }
     $container->setParameter('kernel.compiled_classes', array_unique($classes));
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:15,代码来源:AddClassesToCachePass.php

示例2: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $parameters = $container->getParameterBag()->all();
     $definitions = $container->getDefinitions();
     $aliases = $container->getAliases();
     foreach ($container->getExtensionConfigs() as $name => $configs) {
         list($namespace, $tag) = explode(':', $name);
         $extension = $container->getExtension($namespace);
         $tmpContainer = new ContainerBuilder($container->getParameterBag());
         $tmpContainer->addObjectResource($extension);
         $extension->load($tag, $configs, $tmpContainer);
         $container->merge($tmpContainer);
     }
     $container->addDefinitions($definitions);
     $container->addAliases($aliases);
     $container->getParameterBag()->add($parameters);
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:20,代码来源:MergeExtensionConfigurationPass.php

示例3: merge

 /**
  * Merges a ContainerBuilder with the current ContainerBuilder configuration.
  *
  * Service definitions overrides the current defined ones.
  *
  * But for parameters, they are overridden by the current ones. It allows
  * the parameters passed to the container constructor to have precedence
  * over the loaded ones.
  *
  * $container = new ContainerBuilder(array('foo' => 'bar'));
  * $loader = new LoaderXXX($container);
  * $loader->load('resource_name');
  * $container->register('foo', new stdClass());
  *
  * In the above example, even if the loaded resource defines a foo
  * parameter, the value will still be 'bar' as defined in the ContainerBuilder
  * constructor.
  */
 public function merge(ContainerBuilder $container)
 {
     if (true === $this->isFrozen()) {
         throw new \LogicException('Cannot merge on a frozen container.');
     }
     $this->addDefinitions($container->getDefinitions());
     $this->addAliases($container->getAliases());
     $this->addInterfaceInjectors($container->getInterfaceInjectors());
     $this->parameterBag->add($container->getParameterBag()->all());
     foreach ($container->getResources() as $resource) {
         $this->addResource($resource);
     }
     foreach ($container->getExtensionConfigs() as $name => $configs) {
         if (isset($this->extensionConfigs[$name])) {
             $this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $configs);
         } else {
             $this->extensionConfigs[$name] = $configs;
         }
     }
 }
开发者ID:spf13,项目名称:symfony,代码行数:38,代码来源:ContainerBuilder.php


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