Ticket #1618 (closed defect: fixed)

Opened 3 months ago

Last modified 1 month ago

Write routes bug

Reported by: ed209 Assigned to: lakiboy
Priority: normal Milestone: 0.6.5
Component: SGL - Url Severity: open
Keywords: routes makeUrl Cc:

Description

Here are 2 routes in var/routes.php

array('named_route_1', '/my/route', array(
'moduleName' => 'somename',
'controller' => 'somename',
'action' => 'someOtherName')),


array('named_route_2', '/my/other/route', array(
'moduleName' => 'somename',
'controller' => 'someDiffernetName',
'action' => 'someOtherName')),

Then in my template I write two makeUrl statements for the above routes:

{makeUrl(#someOtherName#,#somename#,#somename#)} (for route 1)
{makeUrl(#someOtherName#,#someDiffernetName#,#somename#)} (for route 2)

For route one it ouputs a non-routes URL e.g. example.com/somename/action/someOtherName

however for route 2 it correctly writes the URL e.g. example.com/my/other/route

Which would seem as though there is a bug for creating routes where the manager name is the same as the module name.

Change History

06/17/08 17:52:01 changed by demian

  • owner changed from somebody to lakiboy.

06/24/08 11:38:08 changed by lakiboy

  • status changed from new to closed.
  • resolution set to fixed.

Thanks for spotting this.
SGL_Url2 removes controller name (manager name) from URL properties if module has same name as controller. This helped us to simplify regular SGL urls (BC style).

However, doing same for routes makes it impossible to match.

For your particular case (named routes) this fix should solve your problem [3883].

{makeUrl(#named_route_1#)} (for route 1)
{makeUrl(#named_route_2#)} (for route 2)

You can use above syntax for named routes.

But it seems we will have to drop simplification for regular SGL URLs, because it brakes routes matching.