1

I have different entities like: Element, Status, Action, Contributor ...

And I need to create an entity, let say Synonym, which can be related to one of these previous entities

My entity Synonym, can be a synonym of the entity Element or Status or Action ...

I try to use a MappedSuperclass but I'm really lost.

I think this kind of relation is common and must be easy to create with doctrine but I can't find the good way.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
misterlil
  • 11
  • 4
  • 1
    you could just create table synonym with N foreign keys (ManyToOne relationship). Each relationship is to different entity (element, status, action, contributor, ...) – Miro May 06 '16 at 01:30
  • can your class hierarchy be defined like this class Synonym {} class Element extends Synonym {} or Element, Status,.... are some sort of a parent to Synonym? – Drmjo May 06 '16 at 02:13
  • Don't use a MappedSuperclass, but a Table Inheritance. So you will have a unique ID column for all of your tables. Then you just have to relate it with the parent table. – Alsatian May 06 '16 at 07:20
  • I have create a table as proposed by Miro... – misterlil May 06 '16 at 13:52

0 Answers0