本文整理匯總了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));
}