Merge branch 'MDL-57859-master' of git://github.com/merrill-oakland/moodle
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user