Symfony2, Is it possible to have two route for one action in a controller?

梦想与她 提交于 2019-12-04 08:26:50

Yes, it is possible when using YAML (or XML) routing.

Example:

sup_choose_date:
    pattern:   /supervisory/choose/date
    defaults:  { _controller: MyBundle:Default:chooseDate }

user_choose_date:
    pattern:   /edit/choose/date
    defaults:  { _controller: MyBundle:Default:chooseDate }

I is possible on every kind of format including annotation. It should work as long as you have different name for every route.

Worked for me!

You must set different names; if not, specify explicitly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!