1
votes

I followed official tutorials to install FOSUser then SonataUser bundles and my app/Application/Sonata/UserBundle/Entity extension.

Now I'm having 4 tables: fos_user, fos_user_group, fos_user_user and fos_user_user_group.

my security.yml

security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager

my config.yml

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Me\UserBundle\Entity\User
#    user_class: Application\Sonata\UserBundle\Entity\User

my /app/Application/Sonata/UserBundle/Resources/config/doctrine/User.orm.xml

...
<entity name="Application\Sonata\UserBundle\Entity\User" table="fos_user_user">
    <id name="id" column="id" type="integer">
        <generator strategy="AUTO" />
    </id>
</entity>
...

I also have created my UserBundle like it's written fosuser docs.

So users are authenticated with fos_user but sonata admin shows users from fos_user_user

What could be wrong in my config ?

2

2 Answers

2
votes

I've spend couple of hours founding that both fos_user and sonata_user should be registred in config.yml:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: App\UserBundle\Entity\User
    group:
        group_class: App\UserBundle\Entity\Group

sonata_user:
    class:
        user:  Me\UserBundle\Entity\User
        group: Me\UserBundle\Entity\Group
1
votes

I finally restarted the whole FOSUser & SonataUser/Admin installation by following this good tutorial step by step.

I think my error was to extend FOSUser with my bundle while Sonata extends it already with easy extend.

So I completely removed my UserBundle.