Pavel Alazankin
Pavel Alazankin

Reputation: 1395

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.

Upvotes: 3

Views: 1931

Answers (1)

Pavel Alazankin
Pavel Alazankin

Reputation: 1395

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:        [email protected]
        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.

Upvotes: 7

Related Questions