ZF-6737: Chain Route - separator should be configurable
Description
Hi,
with the wonderful Application Ressource Zend_Application_Resource_Router I can easily create my routes from config. For Eyample:
resources.router.routes.pathroute.type = "Zend_Controller_Router_Route_Regex" resources.router.routes.pathroute.route = "(.*)" resources.router.routes.pathroute.defaults.1 = "/" resources.router.routes.pathroute.map.1 = "path" resources.router.routes.pathroute.chains.httpmethod.type = "My_Route_HttpMethod" resources.router.routes.pathroute.chains.httpmethod.methods[] = "PROPFIND" resources.router.routes.pathroute.chains.httpmethod.methods[] = "OPTIONS" resources.router.routes.pathroute.chains.httpmethod.defaults.module = "webdav" resources.router.routes.pathroute.chains.httpmethod.defaults.controller = "server"
So far so good.
Now I need to configure the separator between the two routes in chain. In my previous bootstrap code I have done this:
$oControllerFront = Zend_Controller_Front::getInstance();
$oPathRoute = new Zend_Controller_Router_Route_Regex(...);
$oHttpMethodRoute = new My_Route_HttpMethod(...);
$sSeparator = ''; // empty separator for the http-method-route
$oControllerFront ->getRouter()->addRoute('pathroute-httpmethod',$oPathRoute ->chain($oHttpMethodRoute ,$sSeparator));
But I can't set the chain-seperator by config. In my Opinion, this depends on the internal method in Zend_Controller_Router_Rewrite -> _addChainRoutesFromConfig(...):
if ($route instanceof Zend_Controller_Router_Route_Chain) {
$chainRoute = clone $route;
$chainRoute->chain($childRoute);
} else {
$chainRoute = $route->chain($childRoute);
}
In Zend_Controller_Router_Route_Abstract the method chain knows a opt. param for separator. this method should be also declared in the interface Zend_Controller_Router_Route_Interface.
I have seen this ZF-6296 request and I look forward to the refactoring of the Router, maybe this request could be solved when refactoring?
Comments
Posted by Rob Allen (rob) on 2012-11-20T20:53:19.000+0000
Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".
Feel free to re-open and provide a patch if you want to fix this issue.