On Fri, Feb 28, 2014 at 10:03 AM, andrewferk <[email protected]> wrote:
> I'm curious why the logic of AbstractRestfulController is not in a Restful
> Router. Wouldn't it be more suitable for the routing of Controller and
> Action to be done in the Router? I propose a new Restful Router that
> implements the logic of the Segment Router and AbstractRestfulController,
> and returns a RouteMatch that has the action param set. Then it could be
> passed off to an AbstractActionController. This would also make unit testing
> restful routes possible.

Not combining them simplifies your routing definitions tremendously,
though, and is somewhat semantically better in that it keeps the
operations of a given URI resource grouped under a single definition.
The controller can then determine what HTTP methods are allowed, and
respond appropriately to OPTIONS and HEAD requests, as well as return
405 responses for invalid methods.

If a "restful route" were created, we'd have a problem in that failure
to match route + HTTP method would result in a 404, which is not
nearly the same thing. Alternately, the router would need to be aware
of allowed HTTP methods, and dispatch to a single controller in order
to respond to OPTIONS and 405 requests - which makes the router a fair
bit more than just a router at that point, and treading in the domain
of a controller.

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to