I've created two custom entities and need to create a one to many reference between them. What I would like to achieve is to have the Child entity
with field Parent
that would reference the Parent entity
. On the other hand, the Parent entity
should have field with collection of Children entities
.
The Entity reference
module seems like the obvious choice, but how do I use it strictly from code to reference my custom entities in the way I described?
I also thought of just using Entity's API Entity::setUp()
to load the references. This solutions seems simpler but what is the best Drupalish approach?
Both entities are fieldable.
Entity::setUp()
, but this is very early stage of development. I'm looking for advice before I go further and make bad design decisions. – SiliconMind Oct 24 at 13:05