Doctrine2: OneToMany on mapped superclass

前端 未结 3 741
终归单人心
终归单人心 2020-12-19 01:08

My DB structure is as follows:

work:

  • CTI table Work
  • MappedSuperclass table AbstractImageWork which extends <
相关标签:
3条回答
  • 2020-12-19 01:41

    In others cases happens when you declare @ORM\Entity in an abstract superior class instead of @ORM\MappedSuperclass

    0 讨论(0)
  • 2020-12-19 01:56

    In some cases, when you have such error when inherit from the class that is tagged as @ORM\MappedSuperclass, try to change your properties access level from private to protected

    0 讨论(0)
  • A mapped superclass cannot be an entity, it is not query-able and persistent relationships defined by a mapped superclass must be unidirectional (with an owning side only). This means that One-To-Many associations are not possible on a mapped superclass at all. Furthermore Many-To-Many associations are only possible if the mapped superclass is only used in exactly one entity at the moment. For further support of inheritance, the single or joined table inheritance features have to be used.

    Check it out here: https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/inheritance-mapping.html

    0 讨论(0)
提交回复
热议问题