Symfony 2.3 / FOS User Bundle duplicate definition of column
-
20-12-2019 - |
Question
We use FOSUserBundle with Doctrine and need to change the mapping. The following approach worked fine wth Symfony 2.1.x:
- Our User-Entity extends FOS\UserBundle\Model\User
- Our mapping.orm.yml maps all fields used by the bundle
This is still the recommended approach (https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/doctrine.md)
After upgrade to Symfony 2.3 this no longer works: the update "doctrine:schema:update --force" yields errors of the type
duplicate definition of column "x"
where x is any field already used by FOSUserBundle.
Does anybody know which changes cause this error?
Solution
Not 100% sure if this is relevant to what you are talking about, but it sounds like you need to be using attribute overrides
For example if you wanted to make the salt
property nullable your user entity Acme\UserBundle\Entity\User
would need something like the following mapping
# user.orm.yml
Acme\UserBundle\Entity\User:
type: entity
id:
id:
type: integer
generator: { strategy: AUTO }
attributeOverride:
salt:
nullable: true
# Other mapping definitions ...