开发者

Is it possible to assign multiple URLs to one routing rule?

I'm wondering if anyone knows if it's possible to assign more than one static URL to a single routing rule in Symfony 1.4 + Doctrine 1.2.

What I'm after is something like...开发者_StackOverflow社区

my_routing_rule:
  url:    {/first-url/, /second-url/, /third-url/}
  param:  {module: mymodule, action: myaction}

The URLs would be static and I can't use a variable :something in this case.


Try it this way:

my_routing_rule:
  url:   /:something/
  param: { module: mymodule, action: myaction }
  requirements:
    something: /^(first_url|second_url|third_url)$/


It would be a problem when trying to do the reverse(url_for("@my_routing_rule"). So you need to have three different names.

my_routing_rule_first:
  url:    {/first-url/}
  param:  {module: mymodule, action: myaction}
my_routing_rule_second:
  url:    {/second-url/}
  param:  {module: mymodule, action: myaction}
my_routing_rule_third:
  url:    { /third-url/}
  param:  {module: mymodule, action: myaction}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜