Architecture for relationships between entities
It seems, as of now, Views relationships (aka JOINs) can not be used with CiviMRF Views Datasets. We will be needing something like that soon (e.g. for displaying Participant information for Event entities) and I wanted to check with other developers of this module, whether my thoughts make sense or if I forgot anything.
Plan is:
- for each dataset, provide means for configuring relationships to other datasets, by adding as many as needed via an "Add more" button
- for each relationship added, define the dataset, its key field and the corresponding foreign key field in the current dataset, e.g. for an Event entity: "Create relationship to:
Contact
on key field:id
matching key field inEvent
:created_id
" - persist those connections as a configuration entity
- add a relationship handler for each relationship in the Views API implementation, that queries the configured dataset with the given parameters (
IN
operator for keys) and adds relationship information to the result.
Any thoughts or comments higly appreciated!