将实体添加到 Symfony2 SonataAdminBundle 仪表板
我正在尝试为我的 Symfony2 项目集成 SonataAdminBundle 。为了安全起见,我扩展了 FOSUserBundle,现在尝试添加用户管理。
我安装了SonataAdminBundle,对其进行了设置(http://symfony2.local/admin/dashboard 路径有效,使用 sonata.admin.security.handler.noop
与 Symfony2 防火墙),创建了基于 UserAdmin 类SonataUserBundle 但仪表板页面上没有显示任何内容。
服务配置是:
# 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]
我尝试使用 php app/console sonata:admin:explain g.user.admin.user 从控制台获取信息 - 显示有关管理的所有信息,并带有唯一的警告:
Getters constraints
no getter constraints defined !!
所以我的问题是:我可能会错过什么,因此有关实体的信息没有出现在管理仪表板页面上?
I'm trying to integrate SonataAdminBundle for my Symfony2 project. I extended FOSUserBundle for security and now trying to add 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过添加以下代码解决:
Solved by adding the following code: