Added functionality to allow to remove slave objects in database in case of deletion
This commit is contained in:
parent
d48d7eb853
commit
ed47052a59
@ -310,7 +310,9 @@ abstract class AbstractCommonClubsModel
|
|||||||
$q->where("id = {$this->id}");
|
$q->where("id = {$this->id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Add additional filter to remove associations of the object
|
protected function prepareDelete()
|
||||||
|
{}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$db = Factory::getDbo();
|
$db = Factory::getDbo();
|
||||||
@ -322,6 +324,7 @@ abstract class AbstractCommonClubsModel
|
|||||||
$q->where("id = {$this->id}");
|
$q->where("id = {$this->id}");
|
||||||
|
|
||||||
$db->transactionStart();
|
$db->transactionStart();
|
||||||
|
$this->prepareDelete();
|
||||||
$db->setQuery($q);
|
$db->setQuery($q);
|
||||||
$db->execute();
|
$db->execute();
|
||||||
$db->transactionCommit();
|
$db->transactionCommit();
|
||||||
|
Loading…
Reference in New Issue
Block a user