public static final function create_from_record($enrol) {
        $event = static::create(array(
            'context'  => \context_course::instance($enrol->courseid),
            'objectid' => $enrol->id,
            'other'    => array('enrol' => $enrol->enrol)
        ));
        $event->add_record_snapshot('enrol', $enrol);
        return $event;
    }
public static final function create_from_record($enrol) {
        $event = static::create(array(
            'context'  => \context_course::instance($enrol->courseid),
            'objectid' => $enrol->id,
            'other'    => array('enrol' => $enrol->enrol)
        ));
        $event->add_record_snapshot('enrol', $enrol);
        return $event;
    }
public static final function create_from_record ( $ enrol ) { $ event = static :: create ( array ( 'context' => \ context_course :: instance ( $ enrol -> courseid ) , 'objectid' => $ enrol -> id , 'other' => array ( 'enrol' => $ enrol -> enrol ) ) ) ; $ event -> add_record_snapshot ( 'enrol' , $ enrol ) ; return $ event ; }
Api to Create new event from enrol object.

@param \stdClass $enrol record from DB table 'enrol'
@return \core\event\base returns instance of new event
Api to Create new event from enrol object .