advertisement

Zend Framework Dispatch Workflow (v1.01)

50 %
50 %
advertisement
Information about Zend Framework Dispatch Workflow (v1.01)
Technology

Published on May 9, 2009

Author: polleywong

Source: slideshare.net

Description

I've been researching Zend Framework lately and was curious about what's actually happening behind the scene of the whole dispatch process. I found a wonderful diagram created by Thorsten Ruf (http://nethands.de/download/zenddispatch_en.pdf)

Inspired by it's clear and beautifully presented workflow, I decided to go a step deeper and crawl Zend Framework's code. I came up with my own version of the flexible yet complicated workflow. The Zend Framework version is 1.7, noting that things might have changed a bit in the latest 1.8 version that was released a weeks ago.
advertisement

Zend Framework Basic Request Workflow Chart V 1.01, Created by Polley Wong End User’s Browser Request for a page URL public/index.php Requires application/ bootstrap.php bootstrap.php Register Custom Plugin application/ Initializer that runs $this->initDb(); Runs Pass in Configure include Prepares Front $this->initHelpers(); Pass in Optional Custom Environment paths Controller $this->initView(); Request & Response Front Controller (development/staging/...) $this->initPlugins(); Object Dispatch $this->initRoutes(); $this->initControllers();

Runs Front Controller Dispatch Workflow Chart Front Controller Dispatch V 1.01, Created by Polley Wong Front Controller Register Instantiate Instantiate Request Object Notify Notify Default Request Default and Plugin Broker Plugin Broker Start Routing Object if none Response Object Response Object of of provided if none provided with Router Startup Router Completion Plugin Broker No No Plugin Broker More Plugins with More Plugins with Run Plugin’s Run Plugin’s Yes routeShutdown() Yes routeStartup() method? routeStartup() routeShutdown() method? Find a matching Inject Extract Module, Router route to the returning Controller, Action current values to the and Parameters PATH_INFO Request Object

Runs Front Controller Dispatch Workflow Chart Front Controller Dispatch V 1.01, Created by Polley Wong Routing Process Front Controller Register Instantiate Instantiate Request Object Notify Notify Default Request Default and Plugin Broker Plugin Broker Start Routing Object if none Response Object Response Object of of provided if none provided with Router Startup Router Completion cont. Plugin Broker No No Plugin Broker More Plugins with More Plugins with Run Plugin’s Run Plugin’s Yes routeShutdown() Yes routeStartup() method? routeStartup() routeShutdown() method? Find a matching Inject Extract Module, Router route to the returning Controller, Action current values to the and Parameters PATH_INFO Request Object

Front Controller Dispatch Workflow Chart V 1.01, Created by Polley Wong Yes Replace current Action Replace current Action OR Skip current action Front Controller Skip current action postDispatch Process preDispatch Process Yes Notify Set Notify Notify Did any Action Did any Plugin Broker Request Object'’s Plugin Broker Request Object Plugin Broker cont. preDispatch() reset Controller postDispatch() reset of “isDispatched Flag” of No: and of “isDispatched Flag” Dispatch “isDispatched Flag” Dispatch Loop to Dispatch Response Object Dispatch to FALSE? Process to FALSE? Startup TRUE Startup Completion cont. No Request Request Object No Request Object No Object Plugin Broker More Plugins with More Plugins with More Plugins with Run Plugin’s Run Plugin’s Run Plugin’s dispatchLoopStartup() Yes preDispatch() Yes postDispatch() Yes dispatchLoopStartup() preDispatch() postDispatch() method? method? method?

Front Controller Dispatch Workflow Chart V 1.01, Created by Polley Wong Yes Replace current Action Replace current Action OR Skip current action Skip current action Front Controller postDispatch Process preDispatch Process Yes Notify Set Notify Notify Did any Action Did any Plugin Broker Request Object'’s Plugin Broker Plugin Broker Request Object cont. preDispatch() reset Controller postDispatch() reset of “isDispatched Flag” of No: and of “isDispatched Flag” Dispatch “isDispatched Flag” Dispatch Loop to Dispatch Response Object Dispatch to FALSE? Process to FALSE? Startup TRUE Startup Completion cont. No Request Request Object No Request Object No Object Plugin Broker More Plugins with More Plugins with More Plugins with Run Plugin’s Run Plugin’s Run Plugin’s dispatchLoopStartup() Yes preDispatch() Yes postDispatch() Yes dispatchLoopStartup() preDispatch() postDispatch() method? method? method? Controller Dispatcher FALSE Append buffered content into Response Object’s Call Set TRUE body Action Controller’s Rretrieve Is parameter Is parameter Request Object'’s Load dispatch() method Action Method disableOutputBuffering output buffer disableOutputBuffering “isDispatched Flag” Controller TRUE (Passes the Name from TRUE (default) start TRUE (default) to class file Name of Action Request Object or FALSE? or FALSE? TRUE Destroy Action to the method) FALSE Controller Object Controller Register Notify Is Notify Action Run Run Initialize Action Action Controller Helper Broker “isDispatched Call of the Helper Broker Action Controller’s Action Controller’s Helper Broker with of Flag” == Action Method of preDispatch() postDispatch() Helper Broker Dispatch Startup TRUE? Dispatch Completion No No Action Helper No Run Broker Run More Helpers with More Helpers with More helper in init() method Run Helper’s Run Helper’s setActionController() preDispatch() Yes Yes postDispatch() Yes stack? in preDispatch() postDispatch() method in helper method? method? helper

Front Controller Dispatch Workflow Chart V 1.01, Created by Polley Wong Return the Response Object Front Controller Yes Notify Plugin Broker Is “returnResponse” of sendResponse() Flag set to TRUE? Dispatch Loop cont. Completion Request Object No Plugin Broker More Plugins with Run Plugin’s dispatchLoopShutdown() Yes dispatchLoopShutdown() method? postDispatch Process (cont.) Response Object Output Body Send Headers (echo $content) End User’s Browser Waiting for User Input

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

Zend Framework Dispatch Workflow Diagram - Zend Developer Zone

... I decided to go a step deeper and crawl Zend Framework's code. ... Zend Framework Dispatch Workflow Diagram (v1.01) AccessDenied
Read more

Zend_Controller Basics - Zend_Controller - Zend Framework

The Zend_Controller workflow is implemented ... Zend Framework actually normalizes path ... to dispatch. Zend_Controller_Router_Rewrite decomposes the ...
Read more

Zend Framework » \Zend\Mvc\Application

Zend Mvc Application; ... The most common workflow is: $services = new ZendServiceManagerServiceManager ... dispatch, and view listeners ...
Read more

Zend Framework MVC Request Lifecycle - Zend Developer Zone

When I have done training for Zend Framework, ... prior to the front controller calling its dispatch() ... Zend Framework; Zend Server; Zend Studio
Read more

Zend - Services - Certification - Framework 2

The Zend Framework 2 Certification is an industry ... Dispatch; App Config & Merged ... Zend Framework 1 Certification Zend Framework 2 Certification Zend ...
Read more

Controller Plugins — Zend Framework 2 2.1.4 documentation

Zend Framework 2 2.1.4 ... you may want to dispatch additional controllers from within the ... doing so manually would require this workflow: 1 2
Read more

model view controller - Zend Framework Basic Request ...

Zend Framework Basic Request Workflow. ... that elaborates the detailed workflow of a Zend Framework request. ... Dispatch; The PDF looks ...
Read more

php - Zend Framework, what $this->_forward is doing ...

A part of the Framework docs I swear used to be there explained the dispatch workflow at a general ... Zend Framework _forward to other action inside ...
Read more