MDL-43736 Events: event->contextinstanceid should be used where possible

While restoring event context might not be present (deleted)
So before using context api's check context or use event properties
This commit is contained in:
Rajesh Taneja
2014-01-29 11:39:44 +08:00
parent fefcd9abab
commit fdc729ea57
73 changed files with 154 additions and 136 deletions
+6 -1
View File
@@ -79,7 +79,12 @@ abstract class comment_created extends \core\event\base {
* @return \moodle_url
*/
public function get_url() {
return $this->context->get_url();
$context = $this->get_context();
if ($context) {
return $context->get_url();
} else {
return null;
}
}
/**