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


PHP ContainerBuilder::getCompilerPassConfig方法代码示例

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


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

示例1: getContainer

 protected function getContainer()
 {
     $container = new ContainerBuilder();
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config'));
     $loader->load('monolog.xml');
     $definition = $container->getDefinition('monolog.logger_prototype');
     $container->set('monolog.handler.test', new Definition('%monolog.handler.null.class%', array(100, false)));
     $definition->addMethodCall('pushHandler', array(new Reference('monolog.handler.test')));
     // Handlers
     $container->set('monolog.handler.a', new Definition('%monolog.handler.null.class%', array(100, false)));
     $container->set('monolog.handler.b', new Definition('%monolog.handler.null.class%', array(100, false)));
     $container->set('monolog.handler.c', new Definition('%monolog.handler.null.class%', array(100, false)));
     // Channels
     foreach (array('test', 'foo', 'bar') as $name) {
         $service = new Definition('TestClass', array('false', new Reference('logger')));
         $service->addTag('monolog.logger', array('channel' => $name));
         $container->setDefinition($name, $service);
     }
     $container->setParameter('monolog.handlers_to_channels', array('monolog.handler.a' => array('type' => 'inclusive', 'elements' => array('test')), 'monolog.handler.b' => null, 'monolog.handler.c' => array('type' => 'exclusive', 'elements' => array('foo'))));
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->addCompilerPass(new LoggerChannelPass());
     $container->compile();
     return $container;
 }
开发者ID:nervo,项目名称:MonologBundle,代码行数:25,代码来源:LoggerChannelPassTest.php

示例2: compileContainer

 protected function compileContainer(ContainerBuilder $container)
 {
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->addCompilerPass(new CryptorInjectorPass());
     $container->compile();
     return $container;
 }
开发者ID:GlobalTradingTechnologies,项目名称:crypt-bundle,代码行数:8,代码来源:CryptorInjectorPassTest.php

示例3: testProcessorPass

 public function testProcessorPass()
 {
     $compilerPasses = $this->container->getCompilerPassConfig()->getPasses();
     $processorPasses = array_filter($compilerPasses, function (CompilerPassInterface $compilerPass) {
         return $compilerPass instanceof ProcessorsPass;
     });
     $this->assertCount(1, $processorPasses);
 }
开发者ID:prgtw,项目名称:error-handler-bundle,代码行数:8,代码来源:ProcessorsPassTest.php

示例4: testCompilerPassIsRegistered

 public function testCompilerPassIsRegistered()
 {
     $bundle = new BernardBundle();
     $bundle->build($this->container);
     $passes = $this->container->getCompilerPassConfig()->getBeforeOptimizationPasses();
     $this->assertCount(2, $passes);
     $this->assertInstanceOf('Bernard\\BernardBundle\\DependencyInjection\\Compiler\\ReceiverPass', $passes[0]);
     $this->assertInstanceOf('Bernard\\BernardBundle\\DependencyInjection\\Compiler\\NormalizerPass', $passes[1]);
 }
开发者ID:ruudk,项目名称:BernardBundle,代码行数:9,代码来源:BernardBundleTest.php

示例5: loadsTheExtension

 /**
  * @test
  */
 public function loadsTheExtension()
 {
     $container = new ContainerBuilder();
     $container->registerExtension(new PieceQuestetraExtension());
     $container->loadFromExtension('piece_questetra', array('context_root' => 'https://www.example.com/01234567', 'authentication' => array('user_id' => 'foo@example.com', 'password' => 'u7K1TzgUFcvOG0Ui')));
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     $this->assertTrue($container->has('piece_questetra.questetra_client'));
 }
开发者ID:piece,项目名称:piece-questetra,代码行数:13,代码来源:PieceQuestetraExtensionTest.php

示例6: getContainer

 private function getContainer($file)
 {
     $container = new ContainerBuilder();
     $container->registerExtension(new JuSimpleSearchExtension());
     $fileLocator = new FileLocator(__DIR__ . '/Fixtures');
     $loader = new YamlFileLoader($container, $fileLocator);
     $loader->load($file);
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     return $container;
 }
开发者ID:judimator,项目名称:simple-search-bundle,代码行数:11,代码来源:CompilerPassTest.php

示例7: getContainer

 private function getContainer($file, $debug = false)
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.debug' => $debug)));
     $container->registerExtension(new VilksFileSearchExtension());
     $locator = new FileLocator(__DIR__ . '/Fixtures');
     $loader = new YamlFileLoader($container, $locator);
     $loader->load($file);
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     return $container;
 }
开发者ID:igrizzli,项目名称:file-search-bundle,代码行数:12,代码来源:VilksFileSearchExtensionTest.php

示例8: compile

 public function compile()
 {
     /**
      * @var $pass tubepress_spi_ioc_CompilerPassInterface
      */
     foreach ($this->_tubePressCompilerPasses as $pass) {
         $pass->process($this);
     }
     $compilerConfig = $this->_delegateContainerBuilder->getCompilerPassConfig();
     $compilerConfig->setRemovingPasses(array(new \Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass(), new \Symfony\Component\DependencyInjection\Compiler\RemoveAbstractDefinitionsPass(), new \Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass(), new \Symfony\Component\DependencyInjection\Compiler\RepeatedPass(array(new \Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass(), new \Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass())), new \Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass()));
     $this->_delegateContainerBuilder->compile();
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:12,代码来源:ContainerBuilder.php

示例9: getContainer

 private function getContainer($file, $parameters = [], $debug = false)
 {
     $container = new ContainerBuilder(new ParameterBag(array_merge($parameters, ['kernel.debug' => $debug])));
     $container->registerExtension(new TreeHouseBaseApiExtension());
     $locator = new FileLocator(__DIR__ . '/../Fixtures');
     $loader = new YamlFileLoader($container, $locator);
     $loader->load($file);
     $container->getCompilerPassConfig()->setOptimizationPasses([]);
     $container->getCompilerPassConfig()->setRemovingPasses([]);
     $container->compile();
     return $container;
 }
开发者ID:treehouselabs,项目名称:base-api-bundle,代码行数:12,代码来源:TreeHouseBaseApiExtensionTest.php

示例10: loadContainerFromFile

 /**
  * @param string $file
  *
  * @return ContainerBuilder
  */
 private function loadContainerFromFile($file)
 {
     $container = new ContainerBuilder();
     $container->setParameter('kernel.debug', false);
     $container->setParameter('kernel.cache_dir', '/tmp');
     $container->registerExtension(new OpenOrchestraMediaModelExtension());
     $locator = new FileLocator(__DIR__ . '/Fixtures/config/');
     $loader = new YamlFileLoader($container, $locator);
     $loader->load($file . '.yml');
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     return $container;
 }
开发者ID:itkg-canne,项目名称:open-orchestra-media-bundle,代码行数:19,代码来源:OpenOrchestraMediaModelExtensionTest.php

示例11: build

 /**
  * @param ContainerBuilder $container
  */
 public function build(ContainerBuilder $container)
 {
     $passConfig = $container->getCompilerPassConfig();
     $passConfig->addPass(new AnnotationConfigurationPass($this->kernel));
     $passConfig->addPass(new ServiceConfigurationPass());
     $container->addCompilerPass(new GlobalTaggedServicesPass());
 }
开发者ID:trajedy,项目名称:ThruwayBundle,代码行数:10,代码来源:VoryxThruwayBundle.php

示例12: prependBeforeOptimizationPass

 public static function prependBeforeOptimizationPass(ContainerBuilder $container, CompilerPassInterface $compilerPass)
 {
     $compilerPassConfig = $container->getCompilerPassConfig();
     $beforeOptimizationPasses = $compilerPassConfig->getBeforeOptimizationPasses();
     array_unshift($beforeOptimizationPasses, $compilerPass);
     $compilerPassConfig->setBeforeOptimizationPasses($beforeOptimizationPasses);
 }
开发者ID:ruudk,项目名称:SymfonyBridge,代码行数:7,代码来源:CompilerPassUtil.php

示例13: getContainer

 protected function getContainer()
 {
     $container = new ContainerBuilder();
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../../Resources/config'));
     $loader->load('monolog.xml');
     $definition = $container->getDefinition('monolog.logger_prototype');
     $container->set('monolog.handler.test', new Definition('%monolog.handler.null.class%', array(100, false)));
     $definition->addMethodCall('pushHandler', array(new Reference('monolog.handler.test')));
     $service = new Definition('TestClass', array('false', new Reference('logger')));
     $service->addTag('monolog.logger', array('channel' => 'test'));
     $container->setDefinition('test', $service);
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->addCompilerPass(new LoggerChannelPass());
     $container->compile();
     return $container;
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:17,代码来源:LoggerChannelPassTest.php

示例14: loadExtension

 private function loadExtension(array $config, $compile = true)
 {
     $config = array_merge(['transports' => ['amqp' => []]], $config);
     $this->extension->load(['event_band' => $config], $this->container);
     $this->container->getCompilerPassConfig()->setRemovingPasses(array());
     if ($compile) {
         $this->container->compile();
     }
 }
开发者ID:coyl,项目名称:EventBandSymfonyBundle,代码行数:9,代码来源:EventBandExtensionTest.php

示例15: registersMappingFilesInTheSpecifiedDirectories

 /**
  * @test
  */
 public function registersMappingFilesInTheSpecifiedDirectories()
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.debug' => false, 'kernel.bundles' => array('FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle', 'PieceValidationDirectoryLoaderBundle' => 'Piece\\Bundle\\ValidationDirectoryLoaderBundle\\PieceValidationDirectoryLoaderBundle'), 'kernel.cache_dir' => __DIR__)));
     $container->registerExtension(new FrameworkExtension());
     $container->registerExtension(new PieceValidationDirectoryLoaderExtension());
     $container->loadFromExtension('framework', array('secret' => '154F520832A9BC66316C259EEC70E4FA671A12F5', 'validation' => array('enable_annotations' => false)));
     $container->loadFromExtension('piece_validationdirectoryloader', array('mapping_dirs' => array(__DIR__ . '/Fixtures/validation/a', __DIR__ . '/Fixtures/validation/b')));
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     foreach (array(new Foo(), new Bar(), new Baz()) as $entity) {
         $violations = $container->get('validator')->validate($entity);
         $this->assertEquals(1, count($violations));
         $this->assertSame($entity, $violations[0]->getRoot());
         $entityClass = new \ReflectionObject($entity);
         $this->assertEquals(strtolower($entityClass->getShortName()), $violations[0]->getPropertyPath());
     }
 }
开发者ID:piece,项目名称:piece-validationdirectoryloader-bundle,代码行数:21,代码来源:PieceValidationDirectoryLoaderExtensionTest.php


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