routing.yml import when using FOSRestBundle

夙愿已清 提交于 2019-12-23 03:54:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!