This seems simple but I can\'t get it right:
There are three entities: Fruit
, Vegetable
and Snack
. Snack has the fields
You can create a (abstract) mapped superclass called Food
, which can hold some basic information for Fruit
and Vegetable
.
The keyword for your question is inheritance mapping
, this is the documentation for it: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html#inheritance-mapping
Then you could reference this mapped superclass in your entity relationship.