Zend Framework  3.0
Public Member Functions | List of all members
LazyListenerAggregate Class Reference

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.
 

Detailed Description

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 ));

Constructor & Destructor Documentation

__construct ( array  $listeners,
ContainerInterface  $container,
array  $env = [] 
)

Member Function Documentation

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.

Parameters
EventManagerInterface$events
int$priority
Returns
void

Implements ListenerAggregateInterface.