简体   繁体   中英

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:

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.

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

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.

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