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


PHP ContainerBuilder::addAliases方法代码示例

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


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

示例1: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     $config = $container->getParameter(ModeraActivityLoggerExtension::CONFIG_KEY);
     $aliasConfig = array();
     // alias : id
     $aliasConfig['modera_activity_logger.manager.activity_manager'] = $config['activity_manager'];
     $container->addAliases($aliasConfig);
 }
开发者ID:modera,项目名称:foundation,代码行数:11,代码来源:ServiceAliasCompilerPass.php

示例2: process

 public function process(ContainerBuilder $container)
 {
     if (false === $container->hasParameter('francodacosta.caparica.client.provider.id')) {
         throw new InvalidConfigurationException("[Caparica] Missing client provider id");
     }
     $providerId = $container->getParameter('francodacosta.caparica.client.provider.id');
     $container->addAliases(['francodacosta.caparica.client.provider' => $providerId]);
 }
开发者ID:francodacosta,项目名称:caparica-bundle,代码行数:8,代码来源:ClientProviderPass.php

示例3: process

 /**
  * @param ContainerBuilder $container
  */
 public function process(ContainerBuilder $container)
 {
     $appDefinition = $container->register('proto_kernel.app', Application::class);
     $arguments = [null, null];
     if ($container->hasParameter('app.name')) {
         $arguments[0] = '%app.name%';
     }
     if ($container->hasParameter('app.version')) {
         $arguments[1] = '%app.version%';
     }
     $appDefinition->setArguments($arguments);
     $container->addAliases(['app' => 'proto_kernel.app']);
 }
开发者ID:protobile,项目名称:framework,代码行数:16,代码来源:RegisterApplicationPass.php

示例4: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $container->setAlias('kassko_class_resolver', new Alias('kassko_class_resolver.chain', true));
     $containerAdapterDef = $container->getDefinition('kassko_class_resolver.container');
     $containerAdapterDef->setClass($config['container_adapter_class']);
     $container->addAliases($config['resolvers_aliases']);
     if (isset($config['resolvers'])) {
         foreach ($config['resolvers']['chain'] as $resolverConfig) {
             $resolverDef = new DefinitionDecorator('kassko_class_resolver.chain');
             foreach ($resolverConfig['nested_resolvers'] as $nestedResolverService) {
                 $resolverDef->addMethodCall('add', [new Reference($nestedResolverService)]);
             }
             if (null !== $resolverConfig['service']) {
                 $resolverDef->addMethodCall('setDefault', [new Reference($resolverConfig['service'])]);
             } else {
                 $defaultResolverDef = new Definition($container->getParameter('kassko_class_resolver.default.class'), ['action' => $resolverConfig['on_not_found_class']['action']]);
                 $resolverDef->addMethodCall('setDefault', [$defaultResolverDef]);
             }
             $this->addAliasesByService($container, $config['resolver_aliases'], $resolverConfig['resolver_service']);
         }
         foreach ($config['resolvers']['container'] as $resolverConfig) {
             $container->setDefinition($resolverConfig['resolver_service'], new DefinitionDecorator('kassko_class_resolver.container_aware'));
             $this->addAliasesByService($container, $resolverConfig['resolver_aliases'], $resolverConfig['resolver_service']);
         }
         foreach ($config['resolvers']['map'] as $resolverConfig) {
             foreach ($resolverConfig['items'] as $item) {
                 if ('@' !== substr($item['service'], 0, 1)) {
                     $item['service'] = new Reference($item['service']);
                 }
             }
             $resolverDef = new Definition($container->getParameter('kassko_class_resolver.map.class'), [$resolverConfig['items']]);
             $container->setDefinition($resolverConfig['resolver_service'], $resolverDef);
             $this->addAliasesByService($container, $resolverConfig['resolver_aliases'], $resolverConfig['resolver_service']);
         }
         foreach ($config['resolvers']['factory_adapter'] as $index => $resolverConfig) {
             $resolverDef = new Definition($container->getParameter('kassko_class_resolver.factory_adapter.class'), [new Reference($resolverConfig['adapted_factory']), $resolverConfig['support_method'], $resolverConfig['resolve_method']]);
             $container->setDefinition($resolverConfig['resolver_service'], $resolverDef);
             $this->addAliasesByService($container, $resolverConfig['resolver_aliases'], $resolverConfig['resolver_service']);
         }
         foreach ($config['resolvers']['static_factory_adapter'] as $index => $resolverConfig) {
             $resolverDef = new Definition($container->getParameter('kassko_class_resolver.static_factory_adapter.class'), [$resolverConfig['adapted_factory'], $resolverConfig['support_method'], $resolverConfig['resolve_method']]);
             $container->setDefinition($resolverConfig['resolver_service'], $resolverDef);
             $this->addAliasesByService($container, $resolverConfig['resolver_aliases'], $resolverConfig['resolver_service']);
         }
     }
 }
开发者ID:kassko,项目名称:class-resolver-bundle,代码行数:52,代码来源:KasskoClassResolverExtension.php

示例5: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $parameters = $container->getParameterBag()->all();
     $definitions = $container->getDefinitions();
     $aliases = $container->getAliases();
     foreach ($container->getExtensions() as $name => $extension) {
         $tmpContainer = new ContainerBuilder($container->getParameterBag());
         $tmpContainer->addObjectResource($extension);
         $extension->load($container->getExtensionConfig($name), $tmpContainer);
         $container->merge($tmpContainer);
     }
     $container->addDefinitions($definitions);
     $container->addAliases($aliases);
     $container->getParameterBag()->add($parameters);
 }
开发者ID:noelg,项目名称:symfony-demo,代码行数:18,代码来源:MergeExtensionConfigurationPass.php

示例6: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $config = $this->processConfiguration(new Configuration(), $configs);
     $container->setParameter('pheat.manager.class', $config['manager']['class']);
     $container->setParameter('pheat.context.class', $config['context']['class']);
     $container->addAliases(['pheat.context' => $config['context']['service']]);
     if (!empty($config['providers']['session'])) {
         $loader->load('session.xml');
     }
     if (!empty($config['providers']['config'])) {
         $loader->load('config.xml');
         $container->getDefinition('pheat.provider.config')->setArguments([$config['features']]);
     }
     $loader->load('services.xml');
 }
开发者ID:letchik,项目名称:VendPheatBundle,代码行数:16,代码来源:VendPheatExtension.php

示例7: configureOptions

 /**
  * Configure optional settings
  *
  * @param $config
  * @param ContainerBuilder $container
  */
 protected function configureOptions(&$config, ContainerBuilder $container)
 {
     if ($config['enable_logging'] !== true) {
         Logger::set(new NullLogger());
     }
     if (isset($config['router']['authentication']) && $config['router']['authentication'] !== false) {
         //Inject the authentication manager into the router
         $container->getDefinition('voryx.thruway.server')->addMethodCall('registerModule', [new Reference('voryx.thruway.authentication.manager')]);
     }
     if ($container->hasDefinition('security.user.provider.concrete.in_memory')) {
         $container->addAliases(['in_memory_user_provider' => 'security.user.provider.concrete.in_memory']);
     }
     //Topic State Handler
     if (isset($config['router']['enable_topic_state']) && $config['router']['enable_topic_state'] === true) {
         $container->getDefinition('voryx.thruway.server')->addMethodCall('registerModule', [new Reference('voryx.thruway.topic.state.handler')]);
     }
 }
开发者ID:haroldmodesto,项目名称:ThruwayBundle,代码行数:23,代码来源:VoryxThruwayExtension.php

示例8: 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

示例9: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $parameters = $container->getParameterBag()->all();
     $definitions = $container->getDefinitions();
     $aliases = $container->getAliases();
     foreach ($container->getExtensions() as $name => $extension) {
         if (!($config = $container->getExtensionConfig($name))) {
             // this extension was not called
             continue;
         }
         $config = $container->getParameterBag()->resolveValue($config);
         $tmpContainer = new ContainerBuilder($container->getParameterBag());
         $tmpContainer->addObjectResource($extension);
         $extension->load($config, $tmpContainer);
         $container->merge($tmpContainer);
     }
     $container->addDefinitions($definitions);
     $container->addAliases($aliases);
     $container->getParameterBag()->add($parameters);
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:23,代码来源:MergeExtensionConfigurationPass.php

示例10: configureOptions

 /**
  * Configure optional settings
  *
  * @param $config
  * @param ContainerBuilder $container
  */
 protected function configureOptions(&$config, ContainerBuilder $container)
 {
     //Add optional Manager
     if (isset($config['router']['enable_manager']) && $config['router']['enable_manager'] === true) {
         //Replace the dummy manager with the client manager
         $container->getDefinition('voryx.thruway.manager.client')->setClass('Thruway\\Manager\\ManagerClient');
         //Inject the manager client into the router
         $container->getDefinition('voryx.thruway.server')->addMethodCall('addTransportProvider', [new Reference('voryx.thruway.internal.manager')]);
     }
     if ($config['enable_logging'] !== true) {
         Logger::set(new NullLogger());
     }
     if (isset($config['router']['authentication']) && $config['router']['authentication'] !== false) {
         //Inject the authentication manager into the router
         $container->getDefinition('voryx.thruway.server')->addMethodCall('registerModule', [new Reference('voryx.thruway.authentication.manager')]);
     }
     if ($container->hasDefinition('security.user.provider.concrete.in_memory')) {
         $container->addAliases(['in_memory_user_provider' => 'security.user.provider.concrete.in_memory']);
     }
     //Topic State Handler
     if (isset($config['router']['enable_topic_state']) && $config['router']['enable_topic_state'] === true) {
         $container->getDefinition('voryx.thruway.server')->addMethodCall('registerModule', [new Reference('voryx.thruway.topic.state.handler')]);
     }
 }
开发者ID:ThatCheck,项目名称:ThruwayBundle,代码行数:30,代码来源:VoryxThruwayExtension.php

示例11: testAddAliases

 /**
  * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addAliases
  */
 public function testAddAliases()
 {
     $builder = new ContainerBuilder();
     $builder->setAliases(array('bar' => 'foo'));
     $builder->addAliases(array('foobar' => 'foo'));
     $aliases = $builder->getAliases();
     $this->assertTrue(isset($aliases['bar']));
     $this->assertTrue(isset($aliases['foobar']));
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:12,代码来源:ContainerBuilderTest.php

示例12: addAliases

 public function addAliases(array $aliases)
 {
     return $this->delegate->addAliases($aliases);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:4,代码来源:SandboxContainerBuilder.php

示例13: testAddAliases

 /**
  * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addAliases
  */
 public function testAddAliases()
 {
     $builder = new ContainerBuilder();
     $builder->setAliases(array('bar' => 'foo'));
     $builder->addAliases(array('foobar' => 'foo'));
     $this->assertEquals(array('bar' => 'foo', 'foobar' => 'foo'), $builder->getAliases(), '->getAliases() returns all service aliases');
 }
开发者ID:netixpro,项目名称:symfony,代码行数:10,代码来源:ContainerBuilderTest.php


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