我在这里(http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html)关注使用FOSRestBundle的教程。
设置路线时,我收到错误:
Cannot import resource "D:\xampp\htdocs\SymRestTestApp\src\Per\RestBundle/Resources/config/routing.yml" from "D:/xampp/htdocs/SymRestTestApp/app/config\routing.yml".
我的app / config / routing.yml
per_rest:
resource: "@PerRestBundle/Controller"
type: annotation
prefix: /
per:
type: rest
resource: "@PerRestBundle/Resources/config/routing.yml"
My Per / RestBundle / Resources / config / routing.yml:
organisation:
type: rest
resource: Per\RestBundle\Controller\OrganisationController
user:
type: rest
parent: organisation
resource: Per\RestBundle\Controller\UserController
有人遇到过这个问题吗?如何修复此错误?
答案 0 :(得分:0)
我只是将提交推送到应该解决此问题的存储库。请参阅:https://github.com/nmpolo/Symfony2Rest/commit/d381b0a4652e76d5a4c1576d1afd8fa0e00eb0c1
这是因为FOSRestBundle现在要求您在控制器中实现ClassResourceInterface以使用隐式路由。请参阅:https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Resources/doc/5-automatic-route-generation_single-restful-controller.md#implicit-resource-name-definition