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


PHP Definition::addTag方法代码示例

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


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

示例1: loadInitializer

 /**
  * Load the initializer.
  *
  * @param ContainerBuilder    $container
  * @param HttpKernelInterface $app
  */
 private function loadInitializer(ContainerBuilder $container, $app)
 {
     $definition = new Definition('Laracasts\\Behat\\Context\\KernelAwareInitializer', [$app]);
     $definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, ['priority' => 0]);
     $definition->addTag(ContextExtension::INITIALIZER_TAG, ['priority' => 0]);
     $container->setDefinition('laravel.initializer', $definition);
 }
开发者ID:HRcc,项目名称:Behat-Laravel-Extension,代码行数:13,代码来源:BehatExtension.php

示例2: loadInitializer

 /**
  * Load the initializer.
  *
  * @param ContainerBuilder $container
  * @param \Illuminate\Container\Container $app
  */
 private function loadInitializer(ContainerBuilder $container, $app)
 {
     $definition = new Definition('Arisro\\Behat\\Context\\ApplicationAwareInitializer', [$app]);
     $definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, ['priority' => 0]);
     $definition->addTag(ContextExtension::INITIALIZER_TAG, ['priority' => 0]);
     $container->setDefinition('lumen.initializer', $definition);
 }
开发者ID:arisro,项目名称:behat-lumen-extension,代码行数:13,代码来源:LumenExtension.php

示例3: addResourceListeners

 /**
  * @param ContainerBuilder $container
  * @param MetadataInterface $metadata
  */
 protected function addResourceListeners(ContainerBuilder $container, MetadataInterface $metadata)
 {
     $defaultOptions = ['parent_path_default' => null, 'parent_path_autocreate' => false, 'parent_path_force' => false, 'name_filter' => true, 'name_resolver' => true];
     $metadataOptions = $metadata->hasParameter('options') ? $metadata->getParameter('options') : [];
     if ($diff = array_diff(array_keys($metadataOptions), array_keys($defaultOptions))) {
         throw new InvalidArgumentException(sprintf('Unknown PHPCR-ODM configuration options: "%s"', implode('", "', $diff)));
     }
     $options = array_merge($defaultOptions, $metadataOptions);
     $createEventName = sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), 'create');
     $updateEventName = sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), 'update');
     if ($options['parent_path_default']) {
         $defaultPath = new Definition(DefaultParentListener::class);
         $defaultPath->setArguments([new Reference($metadata->getServiceId('manager')), $options['parent_path_default'], $options['parent_path_autocreate'], $options['parent_path_force']]);
         $defaultPath->addTag('kernel.event_listener', ['event' => $createEventName, 'method' => 'onPreCreate']);
         $container->setDefinition(sprintf('%s.resource.%s.doctrine.odm.phpcr.event_listener.default_path', $metadata->getApplicationName(), $metadata->getName()), $defaultPath);
     }
     if ($options['name_filter']) {
         $nameFilter = new Definition(NameFilterListener::class);
         $nameFilter->setArguments([new Reference($metadata->getServiceId('manager'))]);
         $nameFilter->addTag('kernel.event_listener', ['event' => $createEventName, 'method' => 'onEvent']);
         $nameFilter->addTag('kernel.event_listener', ['event' => $updateEventName, 'method' => 'onEvent']);
         $container->setDefinition(sprintf('%s.resource.%s.doctrine.odm.phpcr.event_listener.name_filter', $metadata->getApplicationName(), $metadata->getName()), $nameFilter);
     }
     if ($options['name_resolver']) {
         $nameResolver = new Definition(NameResolverListener::class);
         $nameResolver->setArguments([new Reference($metadata->getServiceId('manager'))]);
         $nameResolver->addTag('kernel.event_listener', ['event' => $createEventName, 'method' => 'onEvent']);
         $nameResolver->addTag('kernel.event_listener', ['event' => $updateEventName, 'method' => 'onEvent']);
         $container->setDefinition(sprintf('%s.resource.%s.doctrine.odm.phpcr.event_listener.name_resolver', $metadata->getApplicationName(), $metadata->getName()), $nameResolver);
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:35,代码来源:DoctrinePHPCRDriver.php

示例4: loadConfigs

 /**
  * Process the adaptor config configuration.
  *
  * @param array $config
  * @param ContainerBuilder $container
  */
 protected function loadConfigs(array $config, ContainerBuilder $container)
 {
     foreach ($config['configs'] as $name => $arguments) {
         if (!$arguments['enabled']) {
             continue;
         }
         $id = 'integrated_channel.config.memory.' . $name;
         if ($container->hasDefinition($id)) {
             continue;
         }
         // first create the options and for that we need a unique service id
         do {
             $id_options = $id . '.options.' . uniqid();
         } while ($container->hasDefinition($id_options));
         $definition = new Definition('%integrated_channel.config.options.class%');
         $definition->setPublic(false);
         $definition->setArguments([$arguments['options']]);
         $container->setDefinition($id_options, $definition);
         // create the config it self
         $definition = new Definition('%integrated_channel.config.class%');
         $definition->setArguments([$name, $arguments['adaptor'], new Reference($id_options)]);
         if ($arguments['channel']) {
             foreach ($arguments['channel'] as $channel) {
                 $definition->addTag('integrated_channel.config', ['channel' => $channel]);
             }
         } else {
             $definition->addTag('integrated_channel.config');
         }
         $container->setDefinition($id, $definition);
     }
 }
开发者ID:integratedfordevelopers,项目名称:integrated-channel-bundle,代码行数:37,代码来源:IntegratedChannelExtension.php

示例5: getElement

 private function getElement()
 {
     $service = new Definition();
     $service->setClass('stdClass');
     $service->setArguments(array(new Reference('arg.one'), new Reference('arg.two', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), new Reference('arg.three', ContainerInterface::NULL_ON_INVALID_REFERENCE), '@arg.four'));
     $service->addTag('tag.one');
     $service->addTag('tag.two', array('attr' => 'one'));
     $service->addTag('tag.two', array('attr' => 'two'));
     return new ServiceElement('service.one', $service);
 }
开发者ID:vierbergenlars,项目名称:manipulator-bundle,代码行数:10,代码来源:ServiceElementTest.php

示例6: it_adds_translation_loaders_using_only_the_first_tag_alias

 /**
  * @test
  */
 public function it_adds_translation_loaders_using_only_the_first_tag_alias()
 {
     $this->setDefinition('sylius.theme.translation.loader_provider', new Definition(null, [[]]));
     $translationLoaderDefinition = new Definition();
     $translationLoaderDefinition->addTag('translation.loader', ['alias' => 'yml']);
     $translationLoaderDefinition->addTag('translation.loader', ['alias' => 'yaml']);
     $this->setDefinition('translation.loader.yml', $translationLoaderDefinition);
     $this->compile();
     $this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.theme.translation.loader_provider', 0, ['yml' => new Reference('translation.loader.yml')]);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:13,代码来源:TranslatorLoaderProviderPassTest.php

示例7: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $container->setParameter('lexiphanic_encrypted_cookie.cookies', $config['cookies']);
     $container->setParameter('lexiphanic_encrypted_cookie.encryption.service', $config['encryption']['service']);
     $listener = new Definition('Lexiphanic\\EncryptedCookieBundle\\EventListener\\EncryptedCookieListener', ['%lexiphanic_encrypted_cookie.cookies%', new Reference($config['encryption']['service'])]);
     $listener->addTag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 8192]);
     $listener->addTag('kernel.event_listener', ['event' => 'kernel.response', 'method' => 'onKernelResponse', 'priority' => -8192]);
     $container->setDefinition('lexiphanic.encrypted_cookie_listener', $listener);
 }
开发者ID:lexiphanic,项目名称:encrypted-cookie-bundle,代码行数:14,代码来源:LexiphanicEncryptedCookieExtension.php

示例8: createConnectionListener

 /**
  * @param ContainerBuilder $container
  * @param string           $connection
  * @param string           $defaultConnection
  */
 private function createConnectionListener(ContainerBuilder $container, $connection, string $defaultConnection)
 {
     $listenerArguments = [$connection, $connection === $defaultConnection, new Reference('algatux_influx_db.connection.' . $connection . '.http')];
     if ($container->hasDefinition('algatux_influx_db.connection.' . $connection . '.udp')) {
         array_push($listenerArguments, new Reference('algatux_influx_db.connection.' . $connection . '.udp'));
     }
     $listenerDefinition = new Definition(InfluxDbEventListener::class, $listenerArguments);
     $listenerDefinition->addTag('kernel.event_listener', ['event' => 'influxdb.points_collected', 'method' => 'onPointsCollected']);
     $listenerDefinition->addTag('kernel.event_listener', ['event' => 'kernel.terminate', 'method' => 'onKernelTerminate']);
     $container->setDefinition('algatux_influx_db.event_listener.' . $connection, $listenerDefinition);
 }
开发者ID:Algatux,项目名称:influxdb-bundle,代码行数:16,代码来源:InfluxDbExtension.php

示例9: addContainerScopeListener

 /**
  * Adds the container scope listener.
  *
  * @param ContainerBuilder $container
  */
 private function addContainerScopeListener(ContainerBuilder $container)
 {
     if (!method_exists('Symfony\\Component\\DependencyInjection\\Container', 'enterScope')) {
         return;
     }
     $definition = new Definition('Contao\\CoreBundle\\EventListener\\ContainerScopeListener');
     $definition->addArgument(new Reference('service_container'));
     $definition->addTag('kernel.event_listener', ['event' => 'kernel.request', 'method' => 'onKernelRequest', 'priority' => 30]);
     $definition->addTag('kernel.event_listener', ['event' => 'kernel.finish_request', 'method' => 'onKernelFinishRequest', 'priority' => -254]);
     $container->setDefinition('contao.listener.container_scope', $definition);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:16,代码来源:ContaoCoreExtension.php

示例10: definitionProvider

 public function definitionProvider()
 {
     $definitionWithoutTags = new Definition();
     $definitionWithTwoTags = new Definition();
     $tag = 'some_provider';
     $attributesOfFirstTag = array('name' => 'attribute of first tag');
     $definitionWithTwoTags->addTag($tag, $attributesOfFirstTag);
     $attributesOfSecondTag = array('name' => 'attributes of second tag');
     $definitionWithTwoTags->addTag($tag, $attributesOfSecondTag);
     $otherAttributes = array('name' => 'some other attribute');
     return array(array($definitionWithoutTags, $tag, array(), false), array($definitionWithTwoTags, $tag, $attributesOfFirstTag, true), array($definitionWithTwoTags, $tag, $attributesOfSecondTag, true), array($definitionWithTwoTags, $tag, $otherAttributes, false));
 }
开发者ID:kinkinweb,项目名称:lhvb,代码行数:12,代码来源:DefinitionHasTagConstraintTest.php

示例11: testAddResolver

 /**
  * @param int|null $declaredPriority
  * @param int $expectedPriority
  *
  * @covers eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\ChainConfigResolverPass::process
  * @dataProvider addResolverProvider
  */
 public function testAddResolver($declaredPriority, $expectedPriority)
 {
     $resolverDef = new Definition();
     $serviceId = 'some_service_id';
     if ($declaredPriority !== null) {
         $resolverDef->addTag('ezpublish.config.resolver', array('priority' => $declaredPriority));
     } else {
         $resolverDef->addTag('ezpublish.config.resolver');
     }
     $this->setDefinition($serviceId, $resolverDef);
     $this->compile();
     $this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.config.resolver.chain', 'addResolver', array(new Reference($serviceId), $expectedPriority));
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:20,代码来源:ChainConfigResolverPassTest.php

示例12: testAddViewProvider

 /**
  * @dataProvider addViewProviderProvider
  */
 public function testAddViewProvider($declaredPriority, $expectedPriority)
 {
     $def = new Definition();
     if ($declaredPriority !== null) {
         $def->addTag(BlockViewPass::VIEW_PROVIDER_IDENTIFIER, array('priority' => $declaredPriority));
     } else {
         $def->addTag(BlockViewPass::VIEW_PROVIDER_IDENTIFIER);
     }
     $serviceId = 'service_id';
     $this->setDefinition($serviceId, $def);
     $this->compile();
     $this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.view_manager', BlockViewPass::ADD_VIEW_PROVIDER_METHOD, array(new Reference($serviceId), $expectedPriority));
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:16,代码来源:BlockViewPassTest.php

示例13: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     foreach ($config['zones'] as $rule => $zoneOptions) {
         $zoneLoggerDefinition = new Definition('Vesax\\HttpKernelLoggerBundle\\EventListener\\TerminateListener', [new Reference('logger'), new Reference('vesax.http_kernel_logger.formatter'), '|' . $rule . '|']);
         $zoneLoggerDefinition->addTag('kernel.event_subscriber');
         $zoneLoggerDefinition->addTag('monolog.logger', ['channel' => $zoneOptions['channel']]);
         $container->setDefinition('vesax.http_kernel_logger.loggers.' . md5($rule), $zoneLoggerDefinition);
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
开发者ID:vesax,项目名称:http-kernel-logger-bundle,代码行数:16,代码来源:VesaxHttpKernelLoggerExtension.php

示例14: testAddLocationAndContentHandlers

 public function testAddLocationAndContentHandlers()
 {
     $this->setDefinition('ezpublish.persistence.legacy.search.gateway.criteria_converter.content', new Definition());
     $this->setDefinition('ezpublish.persistence.legacy.search.gateway.criteria_converter.location', new Definition());
     $commonServiceId = 'common_service_id';
     $def = new Definition();
     $def->addTag('ezpublish.persistence.legacy.search.gateway.criterion_handler.content');
     $def->addTag('ezpublish.persistence.legacy.search.gateway.criterion_handler.location');
     $this->setDefinition($commonServiceId, $def);
     $this->compile();
     $this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.persistence.legacy.search.gateway.criteria_converter.content', 'addHandler', array(new Reference($commonServiceId)));
     $this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.persistence.legacy.search.gateway.criteria_converter.location', 'addHandler', array(new Reference($commonServiceId)));
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:13,代码来源:CriteriaConverterPassTest.php

示例15: addFormType

 protected function addFormType(array $config, ContainerBuilder $container, $method)
 {
     $fullMethod = 'multisafepay_' . $method;
     $definition = new Definition();
     $definition->setClass('%ruudk_payment_multisafepay.form.default_type.class%');
     $definition->addArgument($fullMethod);
     if ($method === 'ideal') {
         $definition->setClass('%ruudk_payment_multisafepay.form.ideal_type.class%');
         $definition->addArgument(sprintf('%%ruudk_payment_multisafepay.ideal.issuers.%s%%', $config['test'] ? 'test' : 'live'));
     }
     $definition->addTag('payment.method_form_type');
     $definition->addTag('form.type', array('alias' => $fullMethod));
     $container->setDefinition(sprintf('ruudk_payment_multisafepay.form.%s_type', $method), $definition);
 }
开发者ID:ruudk,项目名称:payment-multisafepay-bundle,代码行数:14,代码来源:RuudkPaymentMultisafepayExtension.php


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