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


PHP ContainerBuilder::addCompilerPass方法代码示例

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


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

示例1: build

    /**
     * {@inheritdoc}
     */
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new DelegatingLoaderCloningCompilerPass());
        $routingResourcesProvider = new ExtensionPoint('modera_routing.routing_resources');
        $docs = <<<TEXT
This extension points make it possible for bundles to dynamically contribute routing resources so Symfony can detect them,
this way when a new bundle is added then you don't need to update root routing.yml file every time.
This how a sample contribution could look like:

use Sli\\ExpanderBundle\\Ext\\ContributorInterface;

class RoutingResourcesProvider implements ContributorInterface
{
    /**
     * @inheritDoc
     */
    public function getItems()
    {
        return array(
            '@ModeraBackendLanguagesBundle/Resources/config/routing.yml'
        );
    }
}
TEXT;
        $routingResourcesProvider->setDetailedDescription($docs);
        $routingResourcesProvider->setDescription('Allows to dynamically add routing files.');
        $container->addCompilerPass($routingResourcesProvider->createCompilerPass());
    }
开发者ID:modera,项目名称:foundation,代码行数:31,代码来源:ModeraRoutingBundle.php

示例2: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new ScopePolicyCompilerPass());
     $container->addCompilerPass(new MetadataCompilerPass());
     $container->addCompilerPass(new AuthorizationCodeGrantTypeCompilerPass());
     $container->addCompilerPass(new TokenEndpointCompilerPass());
 }
开发者ID:spomky-labs,项目名称:oauth2-server-bundle,代码行数:10,代码来源:ScopeManagerPlugin.php

示例3: setUp

 protected function setUp()
 {
     $this->container = new ContainerBuilder();
     $this->loader = new YamlFileLoader($this->container, new FileLocator());
     $this->container->addCompilerPass(new ExpandServiceValuesPass());
     $this->container->addCompilerPass(new AutowiringPass());
 }
开发者ID:janmarek,项目名称:autowiring-bundle,代码行数:7,代码来源:AutowiringIntegrationTest.php

示例4: build

 public function build(ContainerBuilder $container)
 {
     if (self::getEnvMode()) {
         $container->addCompilerPass(new TwigEnginePass());
         $container->addCompilerPass(new ProfilerCompilerPass());
     }
 }
开发者ID:ChrisWesterfield,项目名称:MJR.ONE-CP,代码行数:7,代码来源:MjrLibraryToolsBundle.php

示例5: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new LoggerPass());
     $container->addCompilerPass(new SecurityContextPass());
     $container->addCompilerPass(new TagSubscriberPass());
     $container->addCompilerPass(new HashGeneratorPass());
 }
开发者ID:jmcclell,项目名称:FOSHttpCacheBundle,代码行数:10,代码来源:FOSHttpCacheBundle.php

示例6: build

 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new ConfigureMiddlewares('simple_bus.asynchronous.command_bus', 'asynchronous_command_bus_middleware'));
     $container->addCompilerPass(new RegisterHandlers('simple_bus.asynchronous.command_bus.command_handler_map', 'asynchronous_command_handler', 'handles'));
     $container->addCompilerPass(new ConfigureMiddlewares('simple_bus.asynchronous.event_bus', 'asynchronous_event_bus_middleware'));
     $container->addCompilerPass(new RegisterSubscribers('simple_bus.asynchronous.event_bus.event_subscribers_collection', 'asynchronous_event_subscriber', 'subscribes_to'));
 }
开发者ID:ruudk,项目名称:AsynchronousBundle,代码行数:7,代码来源:SimpleBusAsynchronousBundle.php

示例7: setUp

 protected function setUp()
 {
     $this->container = new ContainerBuilder();
     $this->mainBusDefinition = new Definition('stdClass');
     $this->container->setDefinition($this->mainBusId, $this->mainBusDefinition);
     $this->container->addCompilerPass(new ConfigureMiddlewares($this->mainBusId, $this->middlewareTag));
 }
开发者ID:hmlb,项目名称:ddd-bundle,代码行数:7,代码来源:ConfigureMiddlewaresTest.php

示例8: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new StatusRendererCompilerPass());
     $container->addCompilerPass(new AdapterCompilerPass());
     $container->addCompilerPass(new FormFactoryCompilerPass());
     $this->registerFormMapping();
 }
开发者ID:Uplink03,项目名称:SonataCoreBundle,代码行数:10,代码来源:SonataCoreBundle.php

示例9: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new Compiler\ConfiguratorPass());
     $container->addCompilerPass(new Compiler\TemplatingPass());
     $container->addCompilerPass(new Compiler\TranslationsPass());
     $container->addCompilerPass(new Compiler\ModelPass());
 }
开发者ID:Yame-,项目名称:mautic,代码行数:10,代码来源:MauticCoreBundle.php

示例10: buildFromConfiguration

 /**
  * @param string $path path to grumphp.yml
  *
  * @return ContainerBuilder
  */
 public static function buildFromConfiguration($path)
 {
     $container = new ContainerBuilder();
     $container->setProxyInstantiator(new RuntimeInstantiator());
     // Add compiler passes:
     $container->addCompilerPass(new Compiler\ExtensionCompilerPass());
     $container->addCompilerPass(new Compiler\PhpParserCompilerPass());
     $container->addCompilerPass(new Compiler\TaskCompilerPass());
     $container->addCompilerPass(new RegisterListenersPass('event_dispatcher', 'grumphp.event_listener', 'grumphp.event_subscriber'));
     // Load basic service file + custom user configuration
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../../resources/config'));
     $loader->load('formatter.yml');
     $loader->load('linters.yml');
     $loader->load('parameters.yml');
     $loader->load('parsers.yml');
     $loader->load('services.yml');
     $loader->load('subscribers.yml');
     $loader->load('tasks.yml');
     $loader->load('util.yml');
     // Load grumphp.yml file:
     $filesystem = new Filesystem();
     if ($filesystem->exists($path)) {
         $loader->load($path);
     }
     // Compile configuration to make sure that tasks are added to the taskrunner
     $container->compile();
     return $container;
 }
开发者ID:phpro,项目名称:grumphp,代码行数:33,代码来源:ContainerFactory.php

示例11: initialize

 /**
  * Initialize the service container (and extensions), and load the config file
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @throws \Exception if user-provided configuration file causes an error
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $root = $input->getArgument('root');
     // Setup container
     $containerBuilder = new ContainerBuilder();
     $extension = new BrancherExtension();
     $containerBuilder->registerExtension($extension);
     $containerBuilder->addCompilerPass(new ExtensionCompilerPass());
     $containerBuilder->addCompilerPass(new RegisterListenersPass('event_dispatcher', 'brancher.event_listener', 'brancher.event_subscriber'));
     // Try and load config file
     $locator = new FileLocator([getcwd(), $input->getArgument('root'), __DIR__ . '/../']);
     /** @var \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */
     $loader = new DelegatingLoader(new LoaderResolver([new YamlFileLoader($containerBuilder, $locator), new XmlFileLoader($containerBuilder, $locator), new PhpFileLoader($containerBuilder, $locator), new IniFileLoader($containerBuilder, $locator)]));
     $config = null;
     try {
         $config = $locator->locate($input->getOption('config'));
         $loader->load($input->getOption('config'));
     } catch (\Exception $ex) {
         // Only rethrow if the issue was with the user-provided value
         if ($input->getOption('config') !== '_config.yml') {
             throw $ex;
         }
     }
     // Add in final config from command line options
     $containerBuilder->setParameter('castlepointanime.brancher.build.config', $config);
     $containerBuilder->loadFromExtension($extension->getAlias(), ['build' => array_filter(['config' => dirname($config) ?: $root, 'root' => $root, 'special' => $input->getOption('special'), 'output' => $input->getArgument('output'), 'templates' => array_filter(array_map('realpath', $input->getOption('template-dir')), 'is_dir'), 'data' => $input->getOption('data-dir'), 'exclude' => $input->getOption('exclude')])]);
     $containerBuilder->compile();
     $this->setContainer($containerBuilder);
 }
开发者ID:castlepointanime,项目名称:brancher,代码行数:37,代码来源:BuildCommand.php

示例12: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     $interfaces = array('DAG\\Component\\Option\\Model\\OptionInterface' => 'dag.model.option.class', 'DAG\\Component\\Option\\Model\\OptionValueInterface' => 'dag.model.option_value.class');
     $container->addCompilerPass(new ResolveDoctrineTargetEntitiesPass('dag_option', $interfaces));
     $mappings = array(realpath(__DIR__ . '/Resources/config/doctrine/model') => 'DAG\\Component\\Option\\Model');
     $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings, array('doctrine.orm.entity_manager'), 'dag_option.driver.doctrine/orm'));
 }
开发者ID:upenn-dag,项目名称:dag-framework,代码行数:10,代码来源:DAGOptionBundle.php

示例13: build

 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new CompilerPass\DatagridConfiguratorPass());
     $container->addCompilerPass(new CompilerPass\TwigRenderEnginePass());
     $container->addCompilerPass(new CompilerPass\ExtensionPass());
     $container->addCompilerPass(new CompilerPass\RuntimeLoaderPass());
 }
开发者ID:rollerworks,项目名称:datagrid-bundle,代码行数:7,代码来源:RollerworksDatagridBundle.php

示例14: build

 public function build(ContainerBuilder $container)
 {
     $container->addCompilerPass(new TemplateResourcesPass());
     $container->addCompilerPass(new TemplateLoaderPass());
     $container->addCompilerPass(new ThemeLoaderPass());
     $container->addCompilerPass(new TwigLoaderPass());
 }
开发者ID:symedit,项目名称:symedit,代码行数:7,代码来源:SymEditThemeBundle.php

示例15: setUp

 protected function setUp()
 {
     $this->container = new ContainerBuilder();
     $this->closeBufferHandlersDefinition = new Definition('LongRunning\\Plugin\\MonologPlugin\\CloseBufferHandlers', array(array()));
     $this->container->setDefinition('long_running.monolog.close_buffer_handlers', $this->closeBufferHandlersDefinition);
     $this->container->addCompilerPass(new MonologCleanersPass());
 }
开发者ID:cmodijk,项目名称:LongRunning,代码行数:7,代码来源:MonologCleanersPassBufferTest.php


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