Is there API support for connecting one entity to another entity in a one to many type situation. I have a "child" entity that I would like to programatically connect to a "parent" entity in a way that would leverage the power and functionality of the Entity API (create, read, update and save).

In my case, the "child" is a location entity and the "parent" is an event entity. I would like to reuse my location entity as a "child" for other entities. From a DB perspective, the "child" entity has a reference id field to point to the parent entity ID.

Now my question - Is their any API that I can use to "connect" these entities? If not, what is a good approach or model for implementing this functionality? I have looked at the Field API, but haven't jumped into the code enough to see if this would actually work, or if it would be a model for an API to connect one a "parent" entity to a "child" entity programatically.

Comments

msellers’s picture

Does anyone have interest in this type of fuctionality? That is, an API (not a module) that defines the connection of one entity to another if a typical database hierarchy. Fields API provides this for simple entities. What about complex entities that may stand-alone for admin and display purposes.

bojanz’s picture

Status: Active » Fixed

Entity reference is used for that.
More advanced widgets are provided by References dialog and Inline Entity Form, allowing you to manage referenced entities on the same screen, for instance.

A more advanced API is Relation.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.