我的 Symfony2 设置遇到了一个非常奇怪的问题。
我正在开发一个安静的网络服务,并且想要设置路由。
我有一个完全运行的应用程序,并且想更改我的routing.yml 配置。
工作配置
my_product:
resource: My\Bundle\ProductBundle\Controller\DefaultController
type: rest
prefix: /
当我将其更改为:
my_product:
resource: "@MyProductBundle/Controller/"
type: rest
prefix: /
我收到以下错误:
Symfony\Component\Config\Exception\FileLoaderLoadException" message="Can't find class for controller "@MyProductBundle/Controller/" in @MyProductBundle/Controller/ (which is being imported from "/home/myproduct/domains/example/v5/app/config/routing.yml"). Make sure the "MyProductBundle" bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure the bundle path "@MyProductBundle/Controller/" is not empty.
当我将类型从“rest”更改为“annotation”时,错误消失。
我做错了什么?我找不到它,而且我的搜索一无所获。
非常感谢!
最佳答案
当前,使用 FOSRestBundle 时无法一次性导入 bundle 的所有 Controller 。 It will be added in FOSRestBundle 2.0 。像第一个示例一样单独导入 Controller 。
关于php - Symfony2 FOS Rest 捆绑路由 FileLoaderLoadException Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32541027/