1

我按照这里的教程 ( 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"

我的 Per/RestBundle/Resources/config/routing.yml:

organisation:
    type: rest
    resource: Per\RestBundle\Controller\OrganisationController

user:
    type: rest
    parent: organisation
    resource: Per\RestBundle\Controller\UserController

有人遇到过这个问题吗?如何修复此错误?

4

1 回答 1

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

于 2013-04-12T14:10:25.890 回答