Added functionality to allow to remove slave objects in database in case of deletion

This commit is contained in:
Christian Wolf 2019-05-22 16:18:09 +02:00
parent d48d7eb853
commit ed47052a59

View File

@ -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();