简体   繁体   English

Symfony 4 Sonata用户捆绑包安装

[英]Symfony 4 Sonata User Bundle Installation

I followed all instructions from installation guide but still have this error during installation of Sonata User Bundle on Symfony 4 application: 我遵循了安装指南中的所有说明,但在Symfony 4应用程序上安装Sonata User Bundle的过程中仍然出现此错误:

Column name `id` referenced for relation from Application\Sonata\UserBundle\Entity\User towards Sonata\UserBundle\Entity\BaseGroup does not exist.

My config is totally same as in installation guide . 我的配置与安装指南中的完全相同。

Didn't find any solutions on stackoverflow or anywhere else. 在stackoverflow或其他任何地方都找不到任何解决方案。

Finally I found the solution, but it took some time, so I want to post it here for everyone who encounter this problem. 最终,我找到了解决方案,但是花了一些时间,因此我想将其发布给所有遇到此问题的人。

Adding this code to config (eg sonata_core.yaml ): 将此代码添加到配置中(例如sonata_core.yaml ):

sonata_user:
    class:
        user:               Application\Sonata\UserBundle\Entity\User
        group:              Application\Sonata\UserBundle\Entity\Group

and changing values of user_class and group_class in config (eg fos_user.yaml ) solves problem: 并在配置中更改user_classgroup_class值(例如fos_user.yaml )可以解决问题:

fos_user:
    db_driver:      orm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User
    from_email:
        address:        noreply@example.com
        sender_name:    John Doe

    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager

    service:
        user_manager: sonata.user.orm.user_manager

There is nothing about this in installation guide , I found it in advanced configuration chapter. 安装指南中没有关于此的内容,我在高级配置章节中找到了。

Hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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