我正在尝试使用symfony和https://github.com/FriendsOfSymfony/FOSRestBundle构建我的休息api 我按照示例中的描述做了所有事情,但每次我将api的类型设置为" rest"在我的routing.yml中,我收到以下错误:
[Symfony\Component\Config\Exception\FileLoaderLoadException]
Class could not be determined for Controller identified by
"InveusUserBundle/Controller/UsersController" in
InveusUserBundle/Controller/UsersController
(which is being imported from "/vagrant/app/config/routing.yml").
Make sure there is a loader supporting the "rest" type.
答案 0 :(得分:-1)
在以下位置添加路径到您的控制器:YourBundle / Resources / config / routing.yml
appRoute:
resource: "@YourBundle/Resources/config/routing.yml"
type: rest
prefix: /api
将您的bundle routing.yml文件嵌入app / config / routing.yml
{{1}}
此配置应修复错误。