adding transaction

This commit is contained in:
Amine Ben hammou
2018-10-04 11:56:54 +02:00
parent c51a3f208c
commit 8c44ef561c

View File

@ -77,8 +77,15 @@ class ScheduledTask extends Model {
}
function delete() {
try {
\ORM::get_db()->beginTransaction();
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) {