FOSUserBundle: Remove unique index for emailCanonical
fosuserbundle, symfony
Solution
The only way to do this is to extend the `FOS\UserBundle\Model\User` class and then re-do all of the mapping (everything in `User.orm.xml`) yourself.
Sources:
- Replacing the mapping of the bundle
- FOSUserBundle Issue #345
Problem
I am trying to remove the unique index on emailCanonical, so that multiple users can share the same email address. However, I do not want to edit FOS/UserBundle/Resources/config/doctrine/User.orm.xml directly as any updates to the bundle itself will remove the change. Is there any way I can override the emailCanonical field in my own bundle, while extending the base user (FOS/UserBundle/Model/User.php) ``` use FOS\UserBundle\Entity\User as BaseUser; use Doctrine\ORM\Mapping as ORM; use Foo\BarBundle\Constant\SecurityConstant; class User extends BaseUser { protected $id; ... } ``` Thanks in advance!