2008年9月11日星期四

[fw-mvc] Strange behavior on Zend_View_Helper_Url

Hi,


I noticed that when I print my urls using the Zend_View_Helper_Url (ZF 1.6.0) I'm getting it right, but... when I'm accessing through a route, it's printing the route.

For example:
I have a route called 'home' that redirects the request /home to my IndexController.
On my home, I have a link to profile and I'm printing like this:

$this->url(array('controller' => 'profile'));

When I access /index it's working fine printing /profile, but when I access /home it's printing the route.

If I pass a route name as parameter (i.e., $this->url(array(), 'route';)) it works fine in both cases.

It seems that the helper simply rewrites the controller, module and action settings sent as parameter with the route settings.

It think it should be slightly different and should work like this:

Route: /home => IndexController;

Accessing the route: /home:
Link 1: $this->url(array('controller' => 'incompatibleController'), 'home'); // Wrong: should throw an exception or, in this case specifically, rewrite the settings according to the route settings
Link 2: $this->url(array('controller' => 'profile')); // Currently, it's printing '/home'. In this case, it should ignore the route and print '/profile'.

Suggestions?


Thanks,

/**
 * Ramses Paiva
 * Software Consultant
 *
 * SourceBits Technologies
 * 63, 19th Main
 * Rajajinagar 2nd Block

 * Bangalore, KA, India
 *
 * Ph  +91 80 4127 7434
 * Mob +91 97 4237 6432

 * Fax +91 80 2342 5494
 * www.sourcebits.com
  */

没有评论: