Commit 74475e5b authored by Andrew Nicols's avatar Andrew Nicols
Browse files

MDL-59890 calendar: Delete category events upon category removal

parent d0e56d84
......@@ -1756,6 +1756,9 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate {
throw new moodle_exception('cannotdeletecategoryquestions', '', '', $this->get_formatted_name());
// Delete all events in the category.
$DB->delete_records('event', array('categoryid' => $this->id));
// Finally delete the category and it's context.
$DB->delete_records('course_categories', array('id' => $this->id));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment