2
votes

I use FOSRESTBundle routing and I want to use parent parameter.

I've found this in this example http://symfony.com/doc/current/bundles/FOSRestBundle/6-automatic-route-generation_multiple-restful-controllers.html#resource-collection

But in my case it doesn't work. When I want to show all my routes by router:debug command, Symfony returns me error:

[Symfony\Component\Config\Exception\FileLoaderLoadException]
The routing file "/home/kamil/public_html/.../routing.yml" contains unsupported keys for "sbg_survey_survey": "parent". Expected one of: "resource", "type", "pre
fix", "pattern", "path", "host", "schemes", "methods", "defaults", "requirements", "options", "condition" in /home/kamil/public_html/.../routing.yml (which is be
ing imported from "/home/kamil/public_html/.../routing_dev.yml").

1

1 Answers

1
votes

Actually I've found solution. Yesterday when I was trying to use it I had some problems, but now it's working correctly.

It's necessary to put these routes to separated file and load this file from app/config/routing.yml

My files:

app/config/routing.yml:

kamil_blog:
    type: rest
    resource: "@KamilBlogBundle/Resources/config/routing.yml"

src/Kamil/BlogBundle/Resources/config/routing.yml:

blog_category:
    resource: "@KamilBlogBundle/Controller/CategoryController.php"
    type:     rest

blog_post:
    resource: "@KamilBlogBundle/Controller/PostController.php"
    type:     rest
    parent:   blog_category