K
K
KOS_MOS2013-11-08 12:32:48
symfony
KOS_MOS, 2013-11-08 12:32:48

One relationship for different entities

There is a base entity, from it, let's say 100 other entities are inherited, which are generally similar, but may contain different sets of fields, etc.
All concrete entities must be able to communicate with each other.

When solving head-on, two problems arise:
- In each entity, you will have to describe all possible relationships with another specific entity
- The data will be denormalized - the data related to the base entity will be duplicated in the table of each specific entity

What we would like:
- The base entity is stored in a separate table
- The base entity has a one-to-one relationship with a specific entity, the identifier and name of the specific entity are used for the relationship.

How to implement this in Doctrine correctly?
Is it even possible to implement this in Doctrine?
How would you do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stnw, 2013-11-08
@stnw

What you describe is very similar to Inheritance Mapping .
You can create a base entity and subentities with their individual properties. All data is stored in one table. You can make selections from the entire list or from specific subentities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question