demianturner / sgl-docs-tickets-migration-test

0 stars 0 forks source link

Write routes bug #1618

Closed demianturner closed 11 years ago

demianturner commented 11 years ago

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.

demianturner commented 11 years ago

[lakiboy] Thanks for spotting this.[[br]] ''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.