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

Lazy listener instance. More...

Public Member Functions

 __construct (array $definition, ContainerInterface $container, array $env=[])
 
 __invoke (EventInterface $event)
 Use the listener as an invokable, allowing direct attachment to an event manager.
 

Detailed Description

Lazy listener instance.

Used to allow lazy creation of listeners via a dependency injection container.

Lazy listener definitions have the following members:

If desired, you can pass $env at instantiation; this will be passed to the container's `build()` method, if it has one, when creating the listener instance.

Pass instances directly to the event manager's `attach()` method as the listener argument.

Constructor & Destructor Documentation

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

Member Function Documentation

__invoke ( EventInterface  $event)

Use the listener as an invokable, allowing direct attachment to an event manager.

Parameters
EventInterface$event
Returns
callable