adding transaction
This commit is contained in:
@ -77,8 +77,15 @@ class ScheduledTask extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
function delete() {
|
||||||
|
try {
|
||||||
|
\ORM::get_db()->beginTransaction();
|
||||||
ScheduledTaskSubscriber::where('task_id', $this->id)->deleteMany();
|
ScheduledTaskSubscriber::where('task_id', $this->id)->deleteMany();
|
||||||
return parent::delete();
|
parent::delete();
|
||||||
|
\ORM::get_db()->commit();
|
||||||
|
} catch(\Exception $error) {
|
||||||
|
\ORM::get_db()->rollBack();
|
||||||
|
throw $error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function touchAllByIds(array $ids) {
|
static function touchAllByIds(array $ids) {
|
||||||
|
Reference in New Issue
Block a user