Issues

ZF-11261: Zend_Navigation url generation with routes doesn't take default route into consideration

Issue Type: Bug Created: 2011-04-05T03:11:35.000+0000 Last Updated: 2011-04-05T07:42:56.000+0000 Status: Closed Fix version(s): Reporter: Anthony Shireman (ashireman) Assignee: Kai Uwe (kaiuwe) Tags: - Zend_Navigation

  • mvc
  • navigation

Related issues: - ZF-6486

Attachments:

Description

Zend_Navigation_Page_Mvc method getRoute() doesn't take a default route into consideration.

When URLs are constructed using the URL helper, the second parameter must be a route name or null. When using a route and viewing a page all helper constructed URLs must use 'default' as the route parameter. However, the Zend_Navigation_Page_Mvc component doesn't take this into consideration. Either all pages in the navigation configuration must define the (in xml form) as default or, the getRoute() method must return the following:

return (is_null($this->_route)) ? 'default' : $this->_route;

This takes a null route and turns it into the default route.

Comments

Posted by Kai Uwe (kaiuwe) on 2011-04-05T07:33:01.000+0000

This is not a bug, this is the normal behaviour!

<pre class="highlight">
public function assemble($userParams, $name = null, $reset = false, $encode = true)
{
    if ($name == null) {
        try {
            $name = $this->getCurrentRouteName();
        } catch (Zend_Controller_Router_Exception $e) {
            $name = 'default';
        }
    }

    // …
}

[http://framework.zend.com/code/filedetails.php/…]

  • "null" means: use the current active route
  • "default" means: use the actual route instance with the name 'default'

Zend_Navigation uses the action helper and router as documented. It is not the task of Zend_Navigation to build a url or to change the behaviour from Zend_Controller_Router.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts