FOSUserBundle:删除emailCanonical的唯一索引 [英] FOSUserBundle: Remove unique index for emailCanonical

查看:60
本文介绍了FOSUserBundle:删除emailCanonical的唯一索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试删除emailCanonical上的唯一索引,以便多个用户可以共享同一电子邮件地址.但是,我不想直接编辑FOS/UserBundle/Resources/config/doctrine/User.orm.xml,因为对捆绑包本身的任何更新都会删除更改.在扩展基本用户(FOS/UserBundle/Model/User.php)的同时,有什么方法可以覆盖我自己的捆绑软件中的emailCanonical字段

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;
...
}

提前谢谢!

推荐答案

执行此操作的唯一方法是扩展FOS\UserBundle\Model\User类,然后自己重​​新进行所有映射(User.orm.xml中的所有操作).

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.

来源:

  • Replacing the mapping of the bundle
  • FOSUserBundle Issue #345

这篇关于FOSUserBundle:删除emailCanonical的唯一索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆