问题
I follow tutorial in here (http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html) about using FOSRestBundle.
When setting up the route, I get error :
Cannot import resource "D:\xampp\htdocs\SymRestTestApp\src\Per\RestBundle/Resources/config/routing.yml" from "D:/xampp/htdocs/SymRestTestApp/app/config\routing.yml".
My 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
Anyone experience this issue? How to fixed this error?
回答1:
I just pushed a commit to the repository which should fix this issue. See: https://github.com/nmpolo/Symfony2Rest/commit/d381b0a4652e76d5a4c1576d1afd8fa0e00eb0c1
This was being caused because the FOSRestBundle now requires you to implement ClassResourceInterface in your controllers to use implicit routing. See: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Resources/doc/5-automatic-route-generation_single-restful-controller.md#implicit-resource-name-definition
来源:https://stackoverflow.com/questions/15491778/routing-yml-import-when-using-fosrestbundle