加载symfony2资源时出现问题


troubles loading symfony2 resources

我在用sf2加载资源时遇到问题,情况如下:

#app/config/routing_rest.yml
rest_api : 
  type : rest
  resource: "@AppBundle/Resources/config/routing_rest.yml"

目前,在groupntig_rest.yml中,我只想加载@AppBundle/UserInterface/Web/Symfony/Controller/文件夹中的所有控制器,这些控制器都将用于休息目的,到目前为止,我发现的唯一可行的方法是:

#src/AppBundle/Resources/config/routing_rest.yml
users : 
  type: rest
  resource:     "@AppBundle/UserInterface/Web/Symfony/Controller/UserRestController.php"
  name_prefix:  api_

您不应该将bundle放在bundle中。要么有两个捆绑包:AppBundle和UserBundle,要么把所有东西都放在一个捆绑包中(这样你就得到了src/AppBundle/Resources/config/routing_rest.yml)。

如果您没有在另一个项目中使用UserBundle的计划,我建议您只使用一个bundle。