2

In this gist, I have 3 controllers defined. I want to establish a parent/child relationship between the cah_annotation and the standard_proposal resource. I cannot find the reason for this error:

$ ./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

The weird thing is, if I modify routing.yml and set the parent resource on cah_annotation to proposal:

cah_annotation:
    parent: proposal

It works fine. Even if I delete the proposal resource entry all together I get the same error.

What am I doing wrong here? These controllers are very similar, how is it that it works with the proposal resource but not standard_proposal?

I am using friendsofsymfony/rest-bundle 1.7.2.

I did see this question already. This does not appear to be the same issue as I worked through that one already.

Community
  • 1
  • 1
  • see answer on http://stackoverflow.com/questions/33087657/every-parent-controller-must-have-getsingularactionid-method-when-i-have , when you use `RouteResource` annotation, you must define `getAction()` method that get a/some `id` for parent/parents and a id for own – ghanbari Oct 22 '15 at 16:33

1 Answers1

0

Maybe you are forgetting add, in the nested Entity, the nested ID parameter in this get{SINGULAR}Action($id):

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

... getSubSub....($subSubId, $subId, $id) ... an so on, on each nested entity.

This one Works for Me.