MDL-76715 mod_data: Remove data_records when the last field is deleted

This commit is contained in:
Amaia Anabitarte
2023-06-13 09:35:09 +02:00
parent f3400f4fc5
commit 789361ae13
5 changed files with 62 additions and 1 deletions
+11
View File
@@ -209,6 +209,17 @@ class manager {
$event->trigger();
}
/**
* Return if the database has records.
*
* @return bool true if the database has records
*/
public function has_records(): bool {
global $DB;
return $DB->record_exists('data_records', ['dataid' => $this->instance->id]);
}
/**
* Return if the database has fields.
*