Symfony\Component\DependencyInjection\Definition::addTag PHP Method

addTag() public method

Adds a tag for this definition.
public addTag ( string $name, array $attributes = [] ) : Definition
$name string The tag name
$attributes array An array of attributes
return Definition The current instance
    public function addTag($name, array $attributes = array())
    {
        $this->tags[$name][] = $attributes;

        return $this;
    }

Usage Example

 /**
  * 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);
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::addTag