From e6e259adf6ed27674ac099eb920c817357eaf276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Tue, 3 Oct 2023 11:41:19 +0200 Subject: [PATCH] DEBUG verify --- demos/init-db.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/demos/init-db.php b/demos/init-db.php index a40c9ff2d3..a84a1b5d8b 100644 --- a/demos/init-db.php +++ b/demos/init-db.php @@ -40,6 +40,13 @@ public function atomic(\Closure $fx) $eRollback = !$connection->inTransaction() ? new \Exception('Prevent modification') : null; // TODO replace with atk4/data Connection before commit hook + if ($eRollback !== null) { + @$connection->outerFromHere = true; + } else { + if (!@$connection->outerFromHere) { + throw new \Error('Unexpected transaction state'); + } + } $res = null; try { parent::atomic(function () use ($fx, $eRollback, &$res) { @@ -51,6 +58,8 @@ public function atomic(\Closure $fx) }); } catch (\Exception $e) { if ($e !== $eRollback) { + $connection->outerFromHere = false; + throw $e; } }