Class Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher

InheritanceSymfony\Component\EventDispatcher\ContainerAwareEventDispatcher » Symfony\Component\EventDispatcher\EventDispatcher
ImplementsSymfony\Component\EventDispatcher\EventDispatcherInterface

Lazily loads listeners and subscribers from the dependency injection container.

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
doDispatch() Triggers the listeners of an event. Symfony\Component\EventDispatcher\EventDispatcher
lazyLoad() Lazily loads listeners for this event from the dependency injection container. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher

Method Details

__construct() public method

Constructor.

public void __construct ( \Symfony\Component\DependencyInjection\ContainerInterface $container )
$container \Symfony\Component\DependencyInjection\ContainerInterface

A ContainerInterface instance

addListenerService() public method

Adds a service as event listener.

public void addListenerService ( $eventName, $callback, $priority 0 )
$eventName string

Event for which the listener is added

$callback array

The service ID of the listener service & the method

                     name that has to be called
$priority int

The higher this value, the earlier an event listener

                     will be triggered in the chain.
                     Defaults to 0.
throws InvalidArgumentException
addSubscriberService() public method

Adds a service as event subscriber.

public void addSubscriberService ( $serviceId, $class )
$serviceId string

The service ID of the subscriber service

$class string

The service's class name (which must implement EventSubscriberInterface)

getContainer() public method

public void getContainer ( )
getListenerPriority() public method

{@inheritdoc}

public void getListenerPriority ( $eventName, $listener )
$eventName
$listener
getListeners() public method

{@inheritdoc}

public void getListeners ( $eventName null )
$eventName
hasListeners() public method

{@inheritdoc}

public void hasListeners ( $eventName null )
$eventName
lazyLoad() protected method

Lazily loads listeners for this event from the dependency injection container.

protected void lazyLoad ( $eventName )
$eventName string

The name of the event to dispatch. The name of

                     the event is the name of the method that is
                     invoked on listeners.
removeListener() public method

public void removeListener ( $eventName, $listener )
$eventName
$listener