Set application instance
public setApplication ( Zend\Mvc\ApplicationInterface $application ) : |
||
$application | Zend\Mvc\ApplicationInterface | |
return |
use Zend\Mvc\MvcEvent; $application = /* application instance */; $event = new MvcEvent(); $event->setApplication($application);
use Zend\Mvc\MvcEvent; use MyModule\EventListener\MyListener; $application = /* application instance */; $event = new MvcEvent(); $event->setApplication($application); $listener = new MyListener(); $listener->onDispatch($event);In this example, the `MyListener` class has a method `onDispatch` that accepts an instance of `MvcEvent`. The `$event` object is instantiated and passed to the `onDispatch` method along with the `$application` instance set previously. Package Library: Zend Framework 2
public setApplication ( Zend\Mvc\ApplicationInterface $application ) : |
||
$application | Zend\Mvc\ApplicationInterface | |
return |