Specify the type of activity source entity
Overview
Activity table has a column source_record_id. It can refer to different entities depending on different activity type. For example, activity type "Event Registration" uses participant records as source records while activity type "Contribution" uses contribution records as source records.
The interpretation of what type of entity the source record is referring is subject to the logics for a selection of activity type defined in the code, in other words, it's hardcoded currently (please point out if this is no longer true).
Proposed Solution
This can be easily improved by adding a source_record_entity_table column to the activity table next to the source_record_id to indicate the entity.
This solution will not only help avoiding hardcoding source record entity but also provide flexibility to both:
- Recording source record: Any activity can refer to any entity that initiated/ is relevant to the activity. Same type of activity can even refer to different entities in different scenarios.
- Interpreting source record: Core and extensions can define the interpretation logics for different activity types and different source record entity. This can potentially be used to enable more tokens in activity based schedule reminders.