original_string: public static function create_from_object($choiceanswer, $choice, $cm, $course) {
          global $USER;
          $eventdata = array();
          $eventdata['objectid'] = $choiceanswer->id;
          $eventdata['context'] = \context_module::instance($cm->id);
          $eventdata['userid'] = $USER->id;
          $eventdata['courseid'] = $course->id;
          $eventdata['relateduserid'] = $choiceanswer->userid;
          $eventdata['other'] = array();
          $eventdata['other']['choiceid'] = $choice->id;
          $eventdata['other']['optionid'] = $choiceanswer->optionid;
          $event = self::create($eventdata);
          $event->add_record_snapshot('course', $course);
          $event->add_record_snapshot('course_modules', $cm);
          $event->add_record_snapshot('choice', $choice);
          $event->add_record_snapshot('choice_answers', $choiceanswer);
          return $event;
      }
code: public static function create_from_object($choiceanswer, $choice, $cm, $course) {
          global $USER;
          $eventdata = array();
          $eventdata['objectid'] = $choiceanswer->id;
          $eventdata['context'] = \context_module::instance($cm->id);
          $eventdata['userid'] = $USER->id;
          $eventdata['courseid'] = $course->id;
          $eventdata['relateduserid'] = $choiceanswer->userid;
          $eventdata['other'] = array();
          $eventdata['other']['choiceid'] = $choice->id;
          $eventdata['other']['optionid'] = $choiceanswer->optionid;
          $event = self::create($eventdata);
          $event->add_record_snapshot('course', $course);
          $event->add_record_snapshot('course_modules', $cm);
          $event->add_record_snapshot('choice', $choice);
          $event->add_record_snapshot('choice_answers', $choiceanswer);
          return $event;
      }
code_tokens: public static function create_from_object ( $ choiceanswer , $ choice , $ cm , $ course ) { global $ USER ; $ eventdata = array ( ) ; $ eventdata [ 'objectid' ] = $ choiceanswer -> id ; $ eventdata [ 'context' ] = \ context_module :: instance ( $ cm -> id ) ; $ eventdata [ 'userid' ] = $ USER -> id ; $ eventdata [ 'courseid' ] = $ course -> id ; $ eventdata [ 'relateduserid' ] = $ choiceanswer -> userid ; $ eventdata [ 'other' ] = array ( ) ; $ eventdata [ 'other' ] [ 'choiceid' ] = $ choice -> id ; $ eventdata [ 'other' ] [ 'optionid' ] = $ choiceanswer -> optionid ; $ event = self :: create ( $ eventdata ) ; $ event -> add_record_snapshot ( 'course' , $ course ) ; $ event -> add_record_snapshot ( 'course_modules' , $ cm ) ; $ event -> add_record_snapshot ( 'choice' , $ choice ) ; $ event -> add_record_snapshot ( 'choice_answers' , $ choiceanswer ) ; return $ event ; }
docstring: Creates an instance of the event from the records
  
  @param stdClass $choiceanswer record from 'choice_answers' table
  @param stdClass $choice record from 'choice' table
  @param stdClass $cm record from 'course_modules' table
  @param stdClass $course
  @return self
docstring_tokens: Creates an instance of the event from the records