【发布时间】:2012-10-18 22:05:55
【问题描述】:
我的数据库结构如下:
工作:
- CTI表工作
- MappedSuperclass 表 AbstractImageWork 扩展了 Work
- 决赛桌 PhotoWork 扩展了 AbstractImageWork
评论:
- MappedSuperclass表评论
- 扩展了Comment的决赛桌WorkComment
WorkComment 与 Work 具有多对一关系:
@ManyToOne(targetEntity="Work", inversedBy="comments")
Work 与 WorkComment 具有 OneToMany 关系:
@OneToMany(targetEntity="WorkComment", mappedBy="work")
问题是 Doctrine 在更新架构时给了我这个错误:
[Doctrine\ORM\Mapping\MappingException]
It is illegal to put an inverse side one-to-many or many-to-many association on
mapped superclass 'Acme\...\AbstractImageWork#comments'.
我猜这与卡在 Work 和 PhotoWork 之间的 MappedSuperclass AbstractImageWork 有关,但我实际上并没有将此关系放在 MappedSuperclass 上,但放在 CTI 表上.. 那么为什么 Doctrine 会这样呢?
有什么想法吗?
【问题讨论】:
标签: doctrine-orm relationship class-table-inheritance mappedsuperclass