Symfony2控制器上的多个路由

时间:2015-11-05 15:03:12

标签: php symfony

在控制器上使用带有注释的symfony2进行路由。

不重复自己我试图在控制器的类声明中定义2个路由,如下所示

/** 
 * @Route(
 *      "/{_locale}/productmanufacturer",
 *      name="tes2"
 *      )
 * @Route(
 *      "/productmanufacturer",
 *      name="tes1",
 *      defaults={"_locale", "pt_BR"}
 *      )
 */
 class ProductManufacturerController extends Controller
 {
  ...
 }

第二条路线没有出现。如果我在Action上添加相同的注释,则路由工作。有谁知道如何把2条路线如上所述?

1 个答案:

答案 0 :(得分:0)

要翻译路线,请查看以下内容:http://jmsyst.com/bundles/JMSI18nRoutingBundle

使用此捆绑包,您还可以通过使用下划线开始路线来删除网址中的区域设置:http://jmsyst.com/bundles/JMSI18nRoutingBundle/master/usage#leaving-routes-untranslated