Search code examples
symfonysonata-adminsymfony-3.4sonata

In sonata admin how can we have multiple levels child admins


I have a need for multiple tiers of admins. The first parent -> child tier works great, but it seems that I'm not able to add a third.

For instance, my structure looks like:

Grandparent -> Parent -> Child

The parent "grandparent" admin with a child "parent" admin works great. But, when I try to add the third tier to the tab menu, I see:

An exception has been thrown during the rendering of a template ("unable to find the route sonata.admin.grandparent|sonata.admin.parent|sonata.admin.child.list").

I'm not really familiar enough with the inner workings to figure this one out....any thoughts? Thanks!


Solution

  • config/services.yaml

    App\Admin\ParentAdmin:
    calls:
        - [addChild, ['@App\Admin\ChildAdmin', 'parent']]
    App\Admin\GrandParentAdmin:
    calls:
        - [addChild, ['@App\Admin\ParentAdmin', 'grandParent']]
    

    Not sure if the above works but then you've GrandParent -> Parent -> Child. More information.

    I hope it helps!