麻烦加载symfony2资源

时间:2015-03-07 12:38:49

标签: php symfony

我在使用sf2加载资源时遇到麻烦,方案如下:

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

在rounting_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_

1 个答案:

答案 0 :(得分:0)

你不应该捆绑捆绑。要么有2个捆绑包:AppBundle和UserBundle,要么将所有内容放在一个捆绑包中(所以最终得到src/AppBundle/Resources/config/routing_rest.yml)。

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