FOSRestBundle父/子资源错误:每个父控制器必须有' get{SINGULAR}Action($id) '方法


FOSRestBundle parent/child resource error: Every parent controller must have `get{SINGULAR}Action($id)` method

在此要点中,我定义了3个控制器。我想在cah_annotation和standard_proposal资源之间建立父/子关系。我找不到这个错误的原因:

$ ./app/console debug:router
[Symfony'Component'Config'Exception'FileLoaderLoadException]                                                    
Every parent controller must have `get{SINGULAR}Action($id)` method                                             
where {SINGULAR} is a singular form of associated object in /var/www/html/cdpaccess/src/ICC/ProposalBundle/Res  
ources/config/routing.yml (which is being imported from "/var/www/html/cdpaccess/app/config/routing.yml").
[InvalidArgumentException]                                           
Every parent controller must have `get{SINGULAR}Action($id)` method  
where {SINGULAR} is a singular form of associated object

奇怪的是,如果我修改路由。并将cah_annotation上的父资源设置为proposal:

cah_annotation:
    parent: proposal

很好。即使我全部删除了提案资源条目,也会得到相同的错误。

我在这里做错了什么?这些控制器非常相似,它是如何与提案资源而不是standard_proposal一起工作的?

我使用的是friendsofsymfony/rest-bundle 1.7.2。

我已经看到这个问题了。

也许您忘记在嵌套实体中添加嵌套ID参数,在此get{SINGULAR}Action($ ID):

class SubEntityController
{
     ...
     getSubEntityAction($subId, $id) {
           ...   
     }
}

…getSubSub……($ subbid, $ subbid, $id)…