Doctrine可以为列使用别名吗?

时间:2019-02-09 14:26:56

标签: mysql inheritance orm doctrine-orm supertype

我有一个利用超类型/子类型策略的现有SQL模式,并且我正在尝试使用类表继承将其复制到Doctrine中。

除了ConcreteChild_1_2,它要求foo对于给定的account_id来说是唯一的,我认为我已经可以正常工作了。

我认为不可能创建一个包含多个表中的列的唯一索引,对吗?

因此,为了执行此规则,我在account_id上添加了ConcreteChild_1_2并在其上放置了适当的唯一索引,但是,Doctrine抱怨该列重复。

我是否需要将ConcreteChild_1_2.account_id重命名为类似ConcreteChild_1_2.account_id_contraint_enforcer的名称,还是可以让Doctrine使用account_id的别名来使SQL表名称保留为account_id? / p>

  • AbstractParent(PK ID,字段account_id
  • AbstractChild_1(PK ID从1到1 FK到AbstractParent.id)
  • AbstractChild_2(PK ID从1到1 FK到AbstractParent.id)
  • ConcreteChild_1_1(PK ID从1到1的FK到AbstractChild1.id)
  • ConcreteChild_1_2(PK ID 1至1 FK到AbstractChild1.id,字段account_idfoo

0 个答案:

没有答案