Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
The MvcEvent — Zend Framework 2 2.0.7 documentation
The MVC layer of Zend Framework 2 incorporates and utilizes a custom Zend\EventManager\Event implementation - Zend\Mvc\MvcEvent. This event is created during Zend\Mvc\Application::bootstrap() and is passed directly to all the events that method triggers. Additionally, if your controllers implement the Zend\Mvc\InjectApplicationEventInterface, MvcEvent will be injected into those controllers.
The MvcEvent adds accessors and mutators for the following:
The methods it defines are:
The Application, Request, Response, Router, and ViewModel are all injected during the bootstrap event. Following the route event, it will be injected also with the RouteMatch object encapsulating the results of routing.
Since this object is passed around throughout the MVC, it is a common location for retrieving the results of routing, the router, and the request and response objects. Additionally, we encourage setting the results of execution in the event, to allow event listeners to introspect them and utilize them within their execution. As an example, the results could be passed into a view renderer.