{"record":{"id":"230fea7fd06298eb","repo":"moodle/moodle","slug":"the-relateduserid-value-must-be-set-230fea","errorCode":null,"errorMessage":"The 'relateduserid' value must be set.","messagePattern":"The 'relateduserid' value must be set\\.","errorType":"exception","errorClass":"coding_exception","httpStatus":null,"severity":"error","filePath":"public/lib/classes/event/competency_user_competency_review_stopped.php","lineNumber":117,"sourceCode":"    }\n\n    /**\n     * Get_objectid_mapping method.\n     *\n     * @return string the name of the restore mapping the objectid links to\n     */\n    public static function get_objectid_mapping() {\n        return base::NOT_MAPPED;\n    }\n\n    /**\n     * Custom validation.\n     *\n     * Throw \\coding_exception notice in case of any problems.\n     */\n    protected function validate_data() {\n        if (!$this->relateduserid) {\n            throw new \\coding_exception('The \\'relateduserid\\' value must be set.');\n        }\n    }\n\n}\n","sourceCodeStart":99,"sourceCodeEnd":122,"githubUrl":"https://github.com/moodle/moodle/blob/48ea8c33227277e916cdd4079dbecef448b37f2c/public/lib/classes/event/competency_user_competency_review_stopped.php#L99-L122","documentation":"Custom validation hook (validate_data) in this core_competency event. Before the event is triggered, Moodle calls validate_data, and this implementation requires relateduserid to be set: a review-stopped event must record which user's competency review was stopped. It fires when code triggers the event without passing relateduserid in the event data — a coding error, since the event is meaningless without the affected user. Fix by including ['relateduserid' => $userid] when creating/triggering the event.","triggerScenarios":"Thrown at public/lib/classes/event/competency_user_competency_review_stopped.php:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide 'relateduserid' when constructing the event","Rely on create_from_user_competency() to set it correctly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"48ea8c33227277e916cdd4079dbecef448b37f2c","analyzedAt":"2026-09-14T20:34:48.527Z","contentChangedAt":"2026-09-14T20:34:48.527Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}