mirror of
https://github.com/Oreolek/kangana.git
synced 2024-06-28 20:55:09 +03:00
subscription deletion
This commit is contained in:
parent
62d49e37fd
commit
da25aa958c
|
@ -124,4 +124,26 @@ class Model_Subscription extends ORM {
|
||||||
->offset($offset)
|
->offset($offset)
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$letter_ids = $this->get_letter_ids($this->id);
|
||||||
|
$query = DB::delete('tasks');
|
||||||
|
if (is_array($letter_ids))
|
||||||
|
{
|
||||||
|
$query->where('letter_id', 'IN', $letter_ids);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query->where('letter_id', '=', $letter_ids);
|
||||||
|
}
|
||||||
|
$query->execute();
|
||||||
|
DB::delete('letters')
|
||||||
|
->where('subscription_id', '=', $this->id)
|
||||||
|
->execute();
|
||||||
|
DB::delete('clients_subscriptions')
|
||||||
|
->where('subscription_id', '=', $this->id)
|
||||||
|
->execute();
|
||||||
|
return parent::delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue