ZF-9372: Zend_Rest_Route issues with routing.

Description

With any of the other Routers you can use them in conjunction with a Front Controller Plugin and hook into the routeShutdown to do any modifications that you need. For some reason Zend_Rest_Router does not return the expected results in the array.

For instance. If I make the request domain.com/2.0/products/11 and I use a standard router I get the following array back

array( 'module' => '2.0', 'controller' => 'products', 'action' => 'get' )

However it seems that Zend_Rest_Route validates the module/controller/action against the dispatcher which is something all of the other routes do not seem to do and i get results like the following:

array( 'controller' => '2.0', 'action' => 'get', 'module' => 'default', 'products' => 11 )

In my case I am trying to hook into the routeShutdown() method so that I may change the version number (module) to be m2m0 as you cannot have modules starting with numbers or with periods in them at all.

I have tried using a regular route and chaining it to the rest router but that goes against rest practices and I could not get it to work chaining in either direction.

As a work around I have had to extend Zend_Rest_Route and override the match() method. However due to the nature of how the match method works I unfortunately had to duplicate the entire method: http://pastebin.com/1F88qaQQ

The only lines I actually changed are lines 32-36.

There should be a way to accomplish this with the Zend_Rest_Route as there is with all of the other routers.

Comments

No comments to display