Fully Qualified Name: | Zend\Mvc\DispatchListener |
Extends: | AbstractListenerAggregate |
Default dispatch listener
Pulls controllers from the service manager's "ControllerManager" service.
If the controller cannot be found a "404" result is set up. Otherwise it will continue to try to load the controller.
If the controller is not dispatchable it sets up a "404" result. In case of any other exceptions it trigger the "dispatch.error" event in an attempt to return a 500 status.
If the controller subscribes to InjectApplicationEventInterface, it injects the current MvcEvent into the controller.
It then calls the controller's "dispatch" method, passing it the request and response. If an exception occurs, it triggers the "dispatch.error" event, in an attempt to return a 500 status.
The return value of dispatching the controller is placed into the result property of the MvcEvent, and returned.
Name | Description | Defined By |
---|---|---|
__construct() | DispatchListener | |
attach() | Attach listeners to an event manager | DispatchListener |
detach() | {@inheritDoc} | AbstractListenerAggregate |
onDispatch() | Listen to the "dispatch" event | DispatchListener |
reportMonitorEvent() | DispatchListener |
Parameter Name | Type | Description |
---|---|---|
$controllerManager | \Controller\ControllerManager |
Returns:
Attach listeners to an event manager
Parameter Name | Type | Description |
---|---|---|
$events | \EventManagerInterface | |
$priority | int |
Returns: void
{@inheritDoc}
Parameter Name | Type | Description |
---|---|---|
$events |
Returns:
Listen to the "dispatch" event
Parameter Name | Type | Description |
---|---|---|
$e | \MvcEvent |
Returns: mixed
Parameter Name | Type | Description |
---|---|---|
$e | \MvcEvent |
Returns: