0
我有两个模型:NoteItem和TaskItem。两者都扩展AbstractStreamItem。Doctrine获取扩展给定抽象类的所有模型的存储库
class AbstractCommentsItem {
...
}
class CommentItem extends AbstractCommentsItem {
...
}
class TaskItem extends AbstractCommentsItem {
...
}
现在我想要在一个getRepository命令中获取两个模型的存储库。
有没有可能?我想过单表继承,但不知道是否是正确的方法。
好吧,我现在有点困惑。所以AbstractCommentsItem应该是@InheritanceType(“SINGLE_TABLE”)?是否有使用@MappedSuperclass的解决方案,因为呈现的类结构让我更加想起这种方法。 – julew
好吧,@MappedSuperclass不会在这里工作。在文档中发现:“映射超类不能是一个实体,它不能查询”。 – julew