本文整理汇总了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());
}
示例2: build
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new ScopePolicyCompilerPass());
$container->addCompilerPass(new MetadataCompilerPass());
$container->addCompilerPass(new AuthorizationCodeGrantTypeCompilerPass());
$container->addCompilerPass(new TokenEndpointCompilerPass());
}
示例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());
}
示例4: build
public function build(ContainerBuilder $container)
{
if (self::getEnvMode()) {
$container->addCompilerPass(new TwigEnginePass());
$container->addCompilerPass(new ProfilerCompilerPass());
}
}
示例5: build
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new LoggerPass());
$container->addCompilerPass(new SecurityContextPass());
$container->addCompilerPass(new TagSubscriberPass());
$container->addCompilerPass(new HashGeneratorPass());
}
示例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'));
}
示例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));
}
示例8: build
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new StatusRendererCompilerPass());
$container->addCompilerPass(new AdapterCompilerPass());
$container->addCompilerPass(new FormFactoryCompilerPass());
$this->registerFormMapping();
}
示例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());
}
示例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;
}
示例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);
}
示例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'));
}
示例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());
}
示例14: build
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new TemplateResourcesPass());
$container->addCompilerPass(new TemplateLoaderPass());
$container->addCompilerPass(new ThemeLoaderPass());
$container->addCompilerPass(new TwigLoaderPass());
}
示例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());
}