ContainerAwareEventManager
class ContainerAwareEventManager extends EventManager
Allows lazy loading of listener services.
Methods
| __construct(ContainerInterface $container) | ||
| bool | dispatchEvent(string $eventName, EventArgs $eventArgs = null) Dispatches an event to all registered listeners. | |
| array | getListeners(string $event = null) Gets the listeners of a specific event or all listeners. | |
| bool | hasListeners(string $event) Checks whether an event has any registered listeners. | |
| addEventListener(string|array $events, object|string $listener) Adds an event listener that listens on the specified events. | ||
| removeEventListener(string|array $events, object|string $listener) Removes an event listener from the specified events. |
Details
__construct(ContainerInterface $container)
Parameters
| ContainerInterface | $container |
bool dispatchEvent(string $eventName, EventArgs $eventArgs = null)
Dispatches an event to all registered listeners.
Parameters
| string | $eventName | The name of the event to dispatch. The name of the event is the name of the method that is invoked on listeners. |
| EventArgs | $eventArgs | The event arguments to pass to the event handlers/listeners. If not supplied, the single empty EventArgs instance is used. |
Return Value
| bool |
array getListeners(string $event = null)
Gets the listeners of a specific event or all listeners.
Parameters
| string | $event | The name of the event |
Return Value
| array | The event listeners for the specified event, or all event listeners |
bool hasListeners(string $event)
Checks whether an event has any registered listeners.
Parameters
| string | $event |
Return Value
| bool | TRUE if the specified event has any listeners, FALSE otherwise |
addEventListener(string|array $events, object|string $listener)
Adds an event listener that listens on the specified events.
Parameters
| string|array | $events | The event(s) to listen on |
| object|string | $listener | The listener object |
Exceptions
| RuntimeException |
removeEventListener(string|array $events, object|string $listener)
Removes an event listener from the specified events.
Parameters
| string|array | $events | |
| object|string | $listener |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bridge/Doctrine/ContainerAwareEventManager.html