本文整理汇总了PHP中Drupal\Core\DependencyInjection\ContainerBuilder::addCompilerPass方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::addCompilerPass方法的具体用法?PHP ContainerBuilder::addCompilerPass怎么用?PHP ContainerBuilder::addCompilerPass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\DependencyInjection\ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder::addCompilerPass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container)
{
// Add a compiler pass for adding Normalizers and Encoders to Serializer.
$container->addCompilerPass(new RegisterSerializationClassesCompilerPass());
// Add a compiler pass for adding concrete Resolvers to chain Resolver.
$container->addCompilerPass(new RegisterEntityResolversCompilerPass());
}
示例2: alter
/**
* @inheritdoc
*/
public function alter(ContainerBuilder $container)
{
drush_log(dt("service modifier alter"), LogLevel::DEBUG);
// http://symfony.com/doc/2.7/components/dependency_injection/tags.html#register-the-pass-with-the-container
$container->register('drush.service.consolecommands', 'Drush\\Command\\ServiceCommandlist');
$container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolecommands', 'console.command'));
$container->register('drush.service.consolidationcommands', 'Drush\\Command\\ServiceCommandlist');
$container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolidationcommands', 'consolidation.commandhandler'));
}
示例3: register
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container)
{
$container->addCompilerPass(new StoragePass());
if (FALSE !== $container->hasDefinition('profiler')) {
$container->register('webprofiler.xhprof', 'Drupal\\xhprof\\DataCollector\\XHProfDataCollector')->addArgument(new Reference('xhprof.profiler'))->addTag('data_collector', array('template' => '@xhprof/Collector/xhprof.html.twig', 'id' => 'xhprof', 'title' => 'XHProf', 'priority' => 50));
}
}
示例4: register
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container)
{
// Add a compiler pass to discover all data collector services.
$container->addCompilerPass(new ProfilerPass());
// Add a compiler pass to discover all available storage backend.
$container->addCompilerPass(new StoragePass());
$container->addCompilerPass(new ServicePass(), PassConfig::TYPE_AFTER_REMOVING);
$container->addCompilerPass(new EventPass(), PassConfig::TYPE_AFTER_REMOVING);
$modules = $container->getParameter('container.modules');
// Add ViewsDataCollector only if Views module is enabled.
if (isset($modules['views'])) {
$container->register('webprofiler.views', 'Drupal\\webprofiler\\DataCollector\\ViewsDataCollector')->addArgument(new Reference('views.executable'))->addArgument(new Reference('entity.manager'))->addTag('data_collector', ['template' => '@webprofiler/Collector/views.html.twig', 'id' => 'views', 'title' => 'Views', 'priority' => 75]);
}
// Add BlockDataCollector only if Block module is enabled.
if (isset($modules['block'])) {
$container->register('webprofiler.blocks', 'Drupal\\webprofiler\\DataCollector\\BlocksDataCollector')->addArgument(new Reference('entity.manager'))->addTag('data_collector', ['template' => '@webprofiler/Collector/blocks.html.twig', 'id' => 'blocks', 'title' => 'Blocks', 'priority' => 78]);
}
// Add TranslationsDataCollector only if Locale module is enabled.
if (isset($modules['locale'])) {
$container->register('webprofiler.translations', 'Drupal\\webprofiler\\DataCollector\\TranslationsDataCollector')->addArgument(new Reference('string_translation'))->addArgument(new Reference('url_generator'))->addTag('data_collector', ['template' => '@webprofiler/Collector/translations.html.twig', 'id' => 'translations', 'title' => 'Translations', 'priority' => 210]);
}
}
示例5: alter
/**
* @inheritdoc
*/
public function alter(ContainerBuilder $container)
{
$container->addCompilerPass(new AddCommandsCompilerPass($this->consoleRoot));
$container->addCompilerPass(new FindCommandsCompilerPass($this->serviceTag));
}
示例6: register
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container)
{
$container->addCompilerPass(new NgLightboxPass());
}
示例7: alter
/**
* @inheritdoc
*/
public function alter(ContainerBuilder $container)
{
$container->addCompilerPass(new AddServicesCompilerPass($this->root));
$container->addCompilerPass(new FindCommandsCompilerPass($this->commandTag));
$container->addCompilerPass(new FindGeneratorsCompilerPass($this->generatorTag));
}