Question

We use FOSUserBundle with Doctrine and need to change the mapping. The following approach worked fine wth Symfony 2.1.x:

  1. Our User-Entity extends FOS\UserBundle\Model\User
  2. 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?

Was it helpful?

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 ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top