I 'm using FOSUserBundle
+ SonataUserBundle
in Symfony2.
I extended Sonata's BaseUser
like this:
namespace ar1y4n\UserBundle\Entity;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User extends BaseUser{
[...]
and my config.yml
is:
fos_user:
db_driver: orm
firewall_name: main
user_class: ar1y4n\UserBundle\Entity\User
group:
group_class: ar1y4n\UserBundle\Entity\Group
sonata_user:
security_acl: true
class: # Entity Classes
user: ar1y4n\UserBundle\Entity\User
group: ar1y4n\UserBundle\Entity\Group
it logins into /admin
area uing users in users
table;
But when viewing users list in admin it shows none of users in users
table;
When I create new user using Add User
in admin page it adds user to fos_user_user
table instead of users
table.
it also created fos_user_user
& fos_user_group
.
What is the problem?
How can I change working table of SonataUserBundle
?
Thanks
Found the problem:
When I extend the
Sonata\UserBundle\Entity\BaseUser
&Sonata\UserBundle\Entity\BaseGroup
I should not generate userbundle in Application namespace usingapp/console sonata:easy-extends:generate SonataUserBundle --dest=src
sonew Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
shouldn't be loaded inAppKernel.php
.Instead in
parameters.yml
I should add these:Now it works with
users
table asar1y4n\UserBundle\Entity\User
entity uses it.