MDL-45319 events: added debugging messages for missing relateduserid value

This commit is contained in:
Mark Nelson 2014-05-06 23:32:14 -07:00 committed by Marina Glancy
parent f1e0f66ca8
commit 425e761712
4 changed files with 36 additions and 1 deletions

View File

@ -124,6 +124,6 @@ class course_completed extends base {
protected function validate_data() {
parent::validate_data();
// TODO: MDL-45319 add validation of relateduserid and other['relateduserid'].
// TODO: MDL-45445 add validation of relateduserid and other['relateduserid'].
}
}

View File

@ -98,4 +98,19 @@ class user_created extends base {
protected function get_legacy_logdata() {
return array(SITEID, 'user', 'add', '/view.php?id='.$this->objectid, fullname($this->get_legacy_eventdata()));
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
}
}

View File

@ -116,6 +116,11 @@ class user_deleted extends base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' value must be set in other.');
}

View File

@ -98,4 +98,19 @@ class user_updated extends base {
protected function get_legacy_logdata() {
return array(SITEID, 'user', 'update', 'view.php?id='.$this->objectid, '');
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
}
}