Php Symfony FOSRestBundle路由多字控制器名称

Php Symfony FOSRestBundle路由多字控制器名称,php,symfony,fosrestbundle,Php,Symfony,Fosrestbundle,我正在为我的web应用程序使用Symfony框架(3.3)和bundle FOSRestBundle 我有一个名为foobarscocontroller的控制器,我想使用“” 问题是,正如您所看到的,控制器是多词复合的 我是否必须注释我的控制器类和方法以映射URL,如“/foo bar”: 使用FOS\RestBundle\Controller\Annotations\Delete; 使用FOS\RestBundle\Controller\Annotations\Get; 使用FOS\RestB

我正在为我的web应用程序使用Symfony框架(3.3)和bundle FOSRestBundle

我有一个名为
foobarscocontroller
的控制器,我想使用“”

问题是,正如您所看到的,控制器是多词复合的

我是否必须注释我的控制器类和方法以映射URL,如“/foo bar”:

使用FOS\RestBundle\Controller\Annotations\Delete;
使用FOS\RestBundle\Controller\Annotations\Get;
使用FOS\RestBundle\Controller\Annotations\Post;
使用FOS\RestBundle\Controller\Annotations\Put;
使用FOS\RestBundle\Controller\Annotations\Route;
使用FOS\RestBundle\Controller\FOSRestController;
/** 
*@Route(“/foo-bar”,默认值={“\u格式”:“json”})
*/
类FooBarsController扩展了FOSRestController
{
/** 
*@Get()
*@View(templateVar=“fooBars”)
*/
受保护的$getFooBarsAction();
/** 
*@Get(“/{id}”,requirements={“id”:“\d+”})
*@View(templateVar=“fooBar”)
*/
受保护的$getFooBarAction($id);
/** 
*@Post()
*@View(templateVar=“fooBar”)
*/
受保护的$postFooBarsAction();
/** 
*@Put(“/{id}”,requirements={“id”:“\d+”})
*@View(templateVar=“fooBar”)
*/
受保护的$putFooBarAction($id);
/** 
*@Delete(“/{id}”,requirements={“id”:“\d+”})
*@View(templateVar=“fooBar”)
*/
受保护的$deleteFooBarAction($id);
}
这样很好,但我想我正在失去自动布线的力量

编辑 以下是我的路由配置文件的一部分:

foo条:
类型:休息
资源:FooBundle\Controller\FooBarsController

您可以发布路由配置吗?我在问题中添加了路由配置。我找到并应用了此“解决方案”:您可以发布路由配置吗?我在问题中添加了路由配置。我找到并应用了此“解决方案”: