3

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.

Pavel Alazankin
  • 1,325
  • 1
  • 12
  • 22

1 Answers1

7

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 (e.g. 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 (e.g. 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.

Pavel Alazankin
  • 1,325
  • 1
  • 12
  • 22
  • It helped me to pass one step, The documentation does say noting about the Custum User bundle. Thanks. – zaizousf Nov 14 '19 at 14:03