ZF-2464: Add return values to Zend_Controller_Router_* for method chaining


The current implementation of Zend_Controller_Router objects does not specify a return value for many of the single-use methods, ie:

    public function addRoutes($routes) {
        foreach ($routes as $name => $route) {
            $this->addRoute($name, $route);

For the sake of method chaining, these functions should return the object ( return $this; ), permitting calls like the following:

    ->addRoute('newRoute', new Zend_Controller_Router_Route(':module/:controller/:action'))
    ->addRoute('newRoute', new Zend_Controller_Router_Route(':controller/:action'))

This currently throws a fatal error: Call to method "addRoute()" on a non-object.


RewrteRouter already allows method chaining:…

Not to nit-pick, but addDefaultRoutes() still doesn't...

David, do you actually use this method? It's an internal method which generally should be protected.

Actually, no... My overridden version of the class did to imitate the functionality of the parent, but no worries. Is this fixed in a release version?