-- Kevin McArthur <[EMAIL PROTECTED]> wrote
(on Monday, 30 October 2006, 10:23 AM -0700):
> P.S.
>
> What exactly is new in the MVC and what will be needed to upgrade to the
> new 0.2.0 from 0.1.5
Nothing, initially. All MVC changes went into the incubator for this
release so that early adopters can start testing and so we can start
creating good migration documentation.
That said, the MVC changes were fairly extensive... and yet for those
using only the basic features, it will work exactly the same.
The biggest changes were the introduction of Request and Response
objects into the chain (and the removal of the Dispatcher Token). The
Request object encapsulates the entire request environment and is pushed
throughout the controller chain. If a router is used (routers are now
optional), it will use the request object to try and determine the
route, and set the request object's controller and action names.
The Response object can be used by your action controllers to aggregate
headers and content; it also will be the location that application
exceptions are registered. As it implements __toString(), it can be
directly echoed at the end of the controller chain to deliver your
response.
What the two in combination offer is something pretty powerful: the
ability to test your applications *without* using a webserver. Simply
craft a request object representing some user input, and pass it through
the application; then check the response on the other side to see if you
get the expected results.
Additionally, request and response objects allow developers to target
other MVC environments, such as the CLI or PHP-GTK applications.
Besides adding request and response objects, here's a laundry list of
other changes:
* You can now register arbitrary data with the front controller to
pass through to the dispatcher, router, and action controllers
* Routers are now optional. The dispatcher will pull the controller
and action directly from the request object and, if none found,
use defaults as registered with itself.
* Action controllers now have their own pre/postDispatch() methods
that are invoked to bookend the actual action call.
* The action controller run() method is now never invoked by the
dispatcher, and instead exists simply to allow usage in a Page
Controller environment. Additionally, it is no longer marked
final.
* Addition of fluid interfaces for all setter methods. This allows
for method chaining when doing common tasks like setting up the
front controller environment.
* The entire controller tree is now fully unit tested.
I will likely be putting together some tutorials in the coming weeks
indicating how to use the new architecture; stay tuned!
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/