3
votes

I get the following error while trying to access the dashboard.

An exception has been thrown during the rendering of a template ("Admin service "app.admin.post" not found in admin pool.")

I use this tutorial ""5.3.2. Using the config.yml"" and I have no idea why I have this error https://symfony.com/doc/current/bundles/SonataAdminBundle/reference/dashboard.html

sonata_admin:
templates:
    dashboard: SonataAdminBundle:Core:dashboard.html.twig
dashboard:
    groups:
        app.admin.group.content:
            label: app.admin.group.content
            label_catalogue: AppBundle
            items:
                - app.admin.post

        app.admin.group.blog:
            items: ~
            item_adds:
                - sonata.admin.page
            roles: [ ROLE_ONE, ROLE_TWO ]

        app.admin.group.misc: ~
1
Yes, it works when i use only "5.3.1. Using the Admin service declaration' in app/config/services.yml but the second way "5.3.2. Using the config.yml" doesn't work and i don't know why [link]symfony.com/doc/current/bundles/SonataAdminBundle/reference/…selecto

1 Answers

0
votes

Did you declared the services following the same tutorial?

services:
    app.admin.post:
        class: AppBundle\Admin\PostAdmin
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "app.admin.group.content"
              label: "app.admin.model.post"
              label_catalogue: "AppBundle"
        arguments:
            - ~
            - AppBundle\Entity\Post
            - ~

Remember that you have to declare them into app/config/services.yml or almost into your src/{whateverBundle}}/Resources/services.yml