Thank you for your help : you are right, I have solved it !
My mistake was to think that "line ? of unknownfile: call to local_groupautoenrol_observer::user_is_enrolled()" was an error. It's not, the real problem was about the new events store stuff.
1/ Here the $event object :
core\event\user_enrolment_created Object ( [data:protected] => Array ( [eventname] => \core\event\user_enrolment_created [component] => core [action] => created [target] => user_enrolment [objecttable] => user_enrolments [objectid] => 50 [crud] => c [edulevel] => 0 [contextid] => 26 [contextlevel] => 50 [contextinstanceid] => 2 [userid] => 2 [courseid] => 2 [relateduserid] => 3 [anonymous] => 0 [other] => Array ( [enrol] => manual ) [timecreated] => 1458127121 ) [logextra:protected] => [context:protected] => context_course Object ( [_id:protected] => 26 [_contextlevel:protected] => 50 [_instanceid:protected] => 2 [_path:protected] => /1/5/26 [_depth:protected] => 3 ) [triggered:core\event\base:private] => 1 [dispatched:core\event\base:private] => [restored:core\event\base:private] => [recordsnapshots:core\event\base:private] => Array ( [user_enrolments] => Array ( [50] => stdClass Object ( [id] => 50 [status] => 0 [enrolid] => 1 [userid] => 3 [timestart] => 1458127099 [timeend] => 0 [modifierid] => 2 [timecreated] => 1458127120 [timemodified] => 1458127120 ) ) ) )
2/ Solution :
$event['other']->enrol->id does not exist but :
$record = $event->get_record_snapshot($event->objecttable, $event->objectid);So my code works now, thanks.
$record->enrolid // OK
That being said, I did not understand everything about the new events store stuff : is there a page about it ?
Pascal