Answer the question
In order to leave comments, you need to log in
How to extend the Doctrine entity class?
Good afternoon.
Given:
There is a User entity, I expand it in the bundle by adding a field. I expand the same entity in another bundle, adding n more fields.
Task:
How to add a record to the database now? After all, extension classes are not related to each other, but only to the parent.
I use Single Table Inheritance
Answer the question
In order to leave comments, you need to log in
General data will be stored in the parent table
. That is, you add an entity to the database:
For other entities, everything is the same ... that is, in the users community, the fields are stored with a common id and type, and the Doctrine itself maps everything
Task:
How to add a record to the database now? After all, extension classes are not related to each other, but only to the parent.
That is, the Doctrine will do everything itself - you only need to specify the DiscriminatorColumn (the entities are mapped in it), if the entities from different bundles are called the same - it is worth filing the DiscriminatorMap
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question