Zend Framework
3.0
|
Aggregate listener for attaching lazy listeners. More...
Public Member Functions | |
__construct (array $listeners, ContainerInterface $container, array $env=[]) | |
attach (EventManagerInterface $events, $priority=1) | |
Attach one or more listeners. | |
Public Member Functions inherited from ListenerAggregateInterface | |
detach (EventManagerInterface $events) | |
Detach all previously attached listeners. | |
Aggregate listener for attaching lazy listeners.
Lazy listeners are listeners where creation is deferred until they are triggered; this removes the most costly mechanism of pulling a listener from a container unless the listener is actually invoked.
Usage is:
$events->attachAggregate(new LazyListenerAggregate( $lazyEventListenersOrDefinitions, $container ));
__construct | ( | array | $listeners, |
ContainerInterface | $container, | ||
array | $env = [] |
||
) |
attach | ( | EventManagerInterface | $events, |
$priority = 1 |
|||
) |
Attach one or more listeners.
Implementors may add an optional $priority argument; the EventManager implementation will pass this to the aggregate.
EventManagerInterface | $events | |
int | $priority |
Implements ListenerAggregateInterface.