Skip to content

Instantly share code, notes, and snippets.

@bakura10
Created January 8, 2013 21:31
Show Gist options
  • Select an option

  • Save bakura10/4488165 to your computer and use it in GitHub Desktop.

Select an option

Save bakura10/4488165 to your computer and use it in GitHub Desktop.

MvcEvent::BOOTSTRAP

This event is triggered by the following classes:

  1. Zend\Mvc\Application: it's triggered in the bootstrap method.

The following classes are listening to this event (they are sorted from higher priority to lower priority):

  1. Class: Zend\Mvc\View\Http\ViewManager. Method: onBootstrap. Priority: 10000. Task: preparing the view layer.

MvcEvent::DISPATCH

This event is triggered by the following classes:

  1. Zend\Mvc\Application: it's triggered in the run method.
  2. Zend\Mvc\Controller\AbstractController: it's triggered in the dispatch method.

The following classes are listening to this event (they are sorted from higher priority to lower priority):

  1. Class: Zend\Mvc\View\Console\ViewManager. Methods: injectNamedParams(1000), createViewModelFromArray()
  2. Class: Zend\Mvc\DispatchListener. Method: onDispatch. Priority: 1. Task: try to load the matched controller from the service manager (and throws various exceptions if it does not). It then calls the dispatch method of the given controller, and if any exception is thrown during the process, it triggers the MvcEvent::DISPATCH_ERROR event.
  3. Class: Zend\Mvc\Controller\AbstractController. Method: onDispatch. Priority: 1. Task: executing the request.
  4. Class: Zend\Mvc\View\Console\CreateViewModelListener. Methods: createViewModelFromString, createViewModelFromArray, createViewModelFromNull. Priority: -80. Task: create a ConsoleModel instance from the getResult of MvcEvent, and then set the ConsoleModel as the new result of the MvcEvent.
  5. Class: Zend\Mvc\View\Console\InjectNamedConsoleParamsListener. Method: injectNamedParams. Priority: -80. Task:

MvcEvent::ROUTE

This event is triggered by the following classes:

  1. Zend\Mvc\Application: it's triggered in the run method. It also has a short circuit callback that allows to stop the propagation of the event if an error is raised during the routing.

The following classes are listening to this event (they are sorted from higher priority to lower priority):

  1. Zend\Mvc\ModuleRouteListener: this event is listened at a priority of 1. The method onRoute is called. This listener determines if the module namespace should be prepended to the controller name. This is the case if the route match contains a parameter key matching the MODULE_NAMESPACE constant.
  2. Zend\Mvc\RouteListener: this event is listened at a priority of 1. The method onRoute is called. It tries to match the request to the router, and if the router does not return a RouteMatch object, this listener triggers the MvcEvent::EVENT_DISPATCH_ERROR.

MvcEvent::RENDER

This event is triggered by the following classes:

  1. Zend\Mvc\Application: it's triggered in the completeRequest method, just before triggering the MvcEvent::FINISH event.

Console context

The following classes are listening to this event in Console context (they are sorted from higher priority to lower priority):

  1. Zend\Mvc\View\Console\DefaultRenderingStrategy: this event is listened at a priority of -10000, and the render method is called.

Http context

The following classes are listening to this event in Http context (they are sorted from higher priority to lower priority):

  1. Zend\Mvc\View\Console\DefaultRenderingStrategy: this event is listened at a priority of -10000, and the render method is called.

MvcEvent::FINISH

This event is triggered by the following classes:

  1. Zend\Mvc\Application: it's triggered in the run and the completeRequest methods.

The following classes are listening to this event (they are sorted from higher priority to lower priority):

  1. Zend\Mvc\SendResponseListener: this event is listened at a priority of -10000, and the sendResponse method is called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment