A third potential inheritance mapping strategy... is it valid? #11025
Replies: 3 comments 14 replies
-
Isn't that allowed with mapped superclasses? |
Beta Was this translation helpful? Give feedback.
-
Traits. ✌️ |
Beta Was this translation helpful? Give feedback.
-
The concept exists https://martinfowler.com/eaaCatalog/concreteTableInheritance.html Implementation is also in Hibernate. Its complicated, because it requires unions for querying the base tables and id generation is "tricky", because it sort of requires UUIDs or sequences. |
Beta Was this translation helpful? Give feedback.
-
We have cases where we want to use inheritance when defining entities purely because there are common fields or functions for several entities. However, we do not want to use STI (where everything goes into one table) or CTI (where there are entries in multiple tables for a single entity). We want each child class to have its own table, which represents all the fields of that entity, no matter where they came from in the inheritance chain.
To me, this seems to give the benefits of inheritance and code reuse without the downsides of STI/CTI. Is there some reason why this is not considered a valid inheritance mapping strategy and is not supported in Doctrine?
Beta Was this translation helpful? Give feedback.
All reactions