From 7bf2386851c17f2f1c424b04e08324de475941d1 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Thu, 23 May 2019 18:05:16 +0200 Subject: [PATCH] Make deletion atomic using transactions even in case of recursive deletions --- src/admin/common/abstract/model.php | 4 ++-- src/admin/views/test/view.html.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/admin/common/abstract/model.php b/src/admin/common/abstract/model.php index 4448ac6..c24aa46 100644 --- a/src/admin/common/abstract/model.php +++ b/src/admin/common/abstract/model.php @@ -344,11 +344,11 @@ abstract class AbstractCommonClubsModel $q->delete($factory->getTableName()); $q->where("id = {$this->id}"); - $db->transactionStart(); + $db->transactionStart(true); $this->prepareDelete($db); $db->setQuery($q); $db->execute(); - $db->transactionCommit(); + $db->transactionCommit(true); } /** diff --git a/src/admin/views/test/view.html.php b/src/admin/views/test/view.html.php index 23694b4..d6049fa 100644 --- a/src/admin/views/test/view.html.php +++ b/src/admin/views/test/view.html.php @@ -21,7 +21,7 @@ class ClubsViewTest extends HtmlView $this->club = $this->clubs[0]; - $c = $this->club; + $c = $factory->loadById(1); $p = $c->getPresident(); $id = $p->getId(); @@ -33,12 +33,12 @@ class ClubsViewTest extends HtmlView $np = $pfactory->createNew(); $np->setName('MyName'); $np->setClub($c); - //$np->save(); +// $np->save(); $np->getId(); - $np = $c->getPlaces()[1]; + $np = $c->getPlaces()[2]; $np->getName(); - $np->setName('foo2 with new Name'); +// $np->setName('foo2 with new Name'); // $np->save(); // $np->delete(); $this->log = $np;