简体   繁体   中英

Symfony - Sonata “Admin service ”app.admin.post“ not found in admin pool.”

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: ~

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM