I'm listening to the \core\event\course_completed event and performing an action (a curl call). While looking at the somewhat vapid documentation [... which I could fix] and reading through code in Moodle and its plugins, I'm finding that some event consumers just look directly at properties of the $event object passed in
$courseid = $event->courseid;
$userid = $event->relateduserid;
whilst other plugins use
$eventdata = $event->get_record_snapshot('course_completions, $event->objectid);
$userid = $eventdata->relateduserid;
I'm thinking that the latter is probably more "correct", but I wanted to ask.