1222. Class

1222.1. Zend\Mvc\DispatchListener

Default dispatch listener

Pulls controllers from the service manager’s “ControllerLoader” 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.

1222.1.1. Methods

1222.1.1.1. attach

attach()

Attach listeners to an event manager

Parameters:EventManagerInterface
Return type:void

1222.1.1.2. detach

detach()

Detach listeners from an event manager

Parameters:EventManagerInterface
Return type:void

1222.1.1.3. onDispatch

onDispatch()

Listen to the “dispatch” event

Parameters:MvcEvent
Return type:mixed

1222.1.1.4. reportMonitorEvent

reportMonitorEvent()

@param MvcEvent $e

1222.1.1.5. complete

complete()

Complete the dispatch

Parameters:
  • mixed
  • MvcEvent
Return type:

mixed

1222.1.1.6. marshallControllerNotFoundEvent

marshallControllerNotFoundEvent()

Marshall a controller not found exception event

Parameters:
  • string
  • string
  • MvcEvent
  • Application
  • Exception
Return type:

mixed

1222.1.1.7. marshallBadControllerEvent

marshallBadControllerEvent()

Marshall a bad controller exception event

Parameters:
  • string
  • MvcEvent
  • Application
  • Exception
Return type:

mixed