Improve code comments for Activity: parent_id and source_record_id
I've done some investigating of the codebase to try to figure out what two columns for Activity entity are for and whether I can. I think I've figured it mostly out but not sure where to document. At the very least I'll improve the comments in the codebase. We don't seem to have a section in the dev guide to deal with this.
So if someone creates a generic activity and schedules a follow-up, the new follow-up activity references the first activity in parent_id
column. Then assigning it to a contact will send an email to that contact and create an activity. And that activity references the follow-up activity in the source_record_id column. I haven't found much documentation yet, except in the parent_id column description where it says that it's for "follow-up items" but claims that it is "not currently implemented." Hm...
The description of source_record_id
also seems to be the only documentation:
Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.
As far as I can tell, "table can be figured out", means just checking for particular activity types before trying to figure out the "FK", and assuming the code creating the activity assigned the activity_type_id
properly.
I'm not really sure what "component registry" means here. As far as I can tell from the code, the component doesn't matter. It's only based on checking the right activity_type_id
.
If Activity was created fresh now I'm guessing it would have gotten entity_table and entity_id instead of this older approach?