开发者

Add entity to Symfony2 SonataAdminBundle dashboard

开发者 https://www.devze.com 2023-03-30 13:53 出处:网络
I\'m trying to integrate SonataAdminBundle for my Symfony2 project. I extended FOSUserBundle for security and now trying to add开发者_StackOverflow社区 users administration.

I'm trying to integrate SonataAdminBundle for my Symfony2 project. I extended FOSUserBundle for security and now trying to add开发者_StackOverflow社区 users administration.

I installed SonataAdminBundle, set it up (http://symfony2.local/admin/dashboard path works, using sonata.admin.security.handler.noop with the Symfony2 firewall), created UserAdmin class based on SonataUserBundle but nothing appears on dashboard page.

Service configuration is:

# src/G/UserBundle/Resources/config/service.yml
services:
    g.user.form.type.security_roles:
        class: G\UserBundle\Form\Type\SecurityRolesType
        tags:
            - { name: form.type, alias: sonata_security_roles}
        arguments: [Sonata\AdminBundle\Admin\Pool]

    g.user.admin.user:
        class: G\UserBundle\Admin\UserAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: user, label: user }
        arguments: [null, G\UserBundle\Entity\User, GUserBundle:UserAdmin]

I tried getting information from console using php app/console sonata:admin:explain g.user.admin.user - displays all information about administration with the only warning:

Getters constraints
   no getter constraints defined !!

So my question is: what could I miss so information about Entity is not appearing on admin dashboard page?


Solved by adding the following code:

# app/config/config.yml
sonata_admin:
    dashboard_groups:
        users:
            label: Users
            items: [g.user.admin.user]
0

精彩评论

暂无评论...
验证码 换一张
取 消