Merge branch 'MDL-57859-master' of git://github.com/merrill-oakland/moodle

This commit is contained in:
David Monllao
2017-02-20 09:42:25 +01:00
2 changed files with 47 additions and 0 deletions
+16
View File
@@ -561,6 +561,22 @@ abstract class persistent {
protected function after_update($result) {
}
/**
* Saves the record to the database.
*
* If this record has an ID, then {@link self::update()} is called, otherwise {@link self::create()} is called.
* Before and after hooks for create() or update() will be called appropriately.
*
* @return void
*/
final public function save() {
if ($this->raw_get('id') <= 0) {
$this->create();
} else {
$this->update();
}
}
/**
* Hook to execute before a delete.
*