Jeder übergeordnete Controller muss die Methode `get {SINGULAR} Action ($ id)` haben, wenn ich eine mehrstufige Subressource im FOS Rest Bundle habe

Ich habe drei Controller namensBlogController, PostController, CommentController DasCommentController ist Subressource vonPostController undPostController Subressource vonBlogController.

/**
 * @Rest\RouteResource("blog", pluralize=false)
 */
class BlogController extends FOSRestController
{
    public function getAction($blogUri)
    {
    ...
    }
}

/**
 * @Rest\RouteResource("post", pluralize=false)
 */
class PostController extends FOSRestController
{
    public function getAction($postId)
    {
    ...
    }
}

/**
 * @Rest\RouteResource("comment", pluralize=false)
 */
class CommentController extends FOSRestController
{
    public function getAction($commentId)
    {
    ...
    }
}

routing.yml

mgh_blog:
    resource: MGH\BlogBundle\Controller\BlogController
    type:     rest

mgh_blog_post:
    resource: MGH\BlogBundle\Controller\PostController
    type:     rest
    parent:   mgh_blog

mgh_blog_post_comment:
    resource: MGH\PostBundle\Controller\CommentController
    type:     rest
    parent:   mgh_blog_post

Ich definieregetAction Methoden, aber ich bekomme folgenden Fehler:

[InvalidArgumentException]                                           
  Every parent controller must have `get{SINGULAR}Action($id)` method  
  where {SINGULAR} is a singular form of associated object 

Bearbeiten

Ich versuche auch, den Namen der Methode in @ zu ändergetCommentAction($commentId), getPostAction($postId) undgetBlogAction, aber es funktioniert nicht.

Wenn ich benutze@RouteResource Anmerkungen, Methodenname muss @ segetAction($id), sonst funktioniert es nicht.

Wenn ich das übergeordnete Element von @ ändemgh_blog_post_comment Router zumgh_blog, es funktioniert

Antworten auf die Frage(6)

Ihre Antwort auf die Frage