Default dispatch listener

Pulls controllers from the service manager's "ControllerLoader" service. If the controller cannot be found, or is not dispatchable, sets up a "404" result.

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.

category Zend
package Zend_Mvc

 Methods

Attach listeners to an event manager

attach(\Zend\EventManager\EventManagerInterface $events) : void

Implementors may add an optional $priority argument; the EventManager implementation will pass this to the aggregate.

Parameters

Detach listeners from an event manager

detach(\Zend\EventManager\EventManagerInterface $events) : void

Listen to the "dispatch" event

onDispatch(\Zend\Mvc\MvcEvent $e) : mixed

Parameters

Returns

mixed

Complete the dispatch

complete(mixed $return, \Zend\Mvc\MvcEvent $event) : mixed

Parameters

$return

mixed

Returns

mixed

Marshall a bad controller exception event

marshallBadControllerEvent(string $controllerName, \Exception $exception, \Zend\Mvc\MvcEvent $event, \Zend\Mvc\Application $application) : mixed

Parameters

$controllerName

string

$exception

\Exception

$application

\Zend\Mvc\Application

Returns

mixed

Marshall a controller not found exception event

marshallControllerNotFoundEvent(string $type, string $controllerName, \Exception $exception, \Zend\Mvc\MvcEvent $event, \Zend\Mvc\Application $application) : mixed

Parameters

$type

string

$controllerName

string

$exception

\Exception

$application

\Zend\Mvc\Application

Returns

mixed

 Properties

 

$listeners

$listeners : \Zend\Stdlib\CallbackHandler[]