php - Cannot attach EVENT_ROUTE in Controller -
I do not understand why the following code does not work, maybe I can not be an event manager / shed event manager india zend framework 2. I do not understand anything.
For now I have not found anything on this internet.
Could it be that the example of an index converter has already been destroyed on EVENT_RENDER and not made on EVENT_ROUTE? Maybe this is the case or am I missing something here?
Class Index Controller Expands AbstractActionController {Public Function Route Event Oxide () {Echo 'Test'; } Public function renderEventOccured () {echo 'test'; } Public Function __construct () {$ this- & gt; GetEventManager () - & gt; Given (MvcEvent :: EVENT_ROUTE, array ($ this 'routeEventOccured')); $ This- & gt; GetEventManager () - & gt; Attached (MvcEvent :: EVENT_RENDER, Array ($ this, 'renderEventOccured')); }} itemprop = "text"> Zend Framework 2 using the concept of event . A class can trigger an event, and can listen for other class events technically, triggering an event means only one more class callback "method "The event management is implemented inside the Zend \ Mvc \ EventManager component. The "life" of the application occurs in several stages each application life level is triggered by an event triggering an application. Other classes (either related to the Zend Framework or specific to your application) can listen to events and respond accordingly.
Below, four main events (life stages) are presented:
Bootstrap . When this event is triggered by the application, a module gets a chance to register as a listener for more app events in its onBootstrap () callback method. Route . When this event begins, the URL of the request is analyzed with the router class (usually Zend \ Mvc \ router \ http \ treeRouteStack class). URL and a route have been received, given to the specified site-specific controller class for the request route. Dispatch . The controller class "dispatches" produces the data which can be displayed on the action method and web page using the same request. Submit . At this event, the jade \ view \ randder \ PhpRenderer class generated by the action of the administrator's action method. Renderer class uses an visual template file to produce the HTML page.
Comments
Post a Comment