ZF-7763: Zend_Navigation_Page_Mvc generates incorrect urls using routes with *
Description
I've just started with ZF, so maybe its not actualy a bug, but for me its an unexpected thing. I'm using route with * modifier to accept additonal params via url. Next is code from docs, the only modification is "/*" in the end of the route
// the following route is added to the ZF router
Zend_Controller_Front::getInstance()->getRouter()->addRoute(
'article_view', // route name
new Zend_Controller_Router_Route(
'a/:id/*',
array(
'module' => 'news',
'controller' => 'article',
'action' => 'view',
'id' => null
)
)
);
// a page is created with a 'route' option
$page = new Zend_Navigation_Page_Mvc(array(
'label' => 'A news article',
'route' => 'article_view',
'module' => 'news', // required for isActive(), see note above
'controller' => 'article', // required for isActive(), see note above
'action' => 'view', // required for isActive(), see note above
'params' => array('id' => 42)
));
// returns: /a/42
$href = $page->getHref();
Actualy will return /a/42/module/news/controller/article/action/view module, controller and action were treated as url parameters.
Comments
Posted by David Caunt (dcaunt) on 2009-09-02T13:02:47.000+0000
I've suffered from this problem as well - if its not a bug I think the manual may be missing some information.
Posted by Robin Skoglund (robinsk) on 2009-09-19T06:56:28.000+0000
The "weirdness" you experience is just the way Zend_Controller_Router* works, and it is not a bug.