From d584065134f77c1183dd3ecbab10197581cb77b3 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:53:46 +0100 Subject: [PATCH] TASK: Use `setRollbackOnly` to ensure nothing is commited during the simulation solves https://github.com/neos/neos-development-collection/pull/5301#issuecomment-2433457506 --- src/DoctrineDbalContentGraphProjection.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DoctrineDbalContentGraphProjection.php b/src/DoctrineDbalContentGraphProjection.php index 1c1b1dc..27be786 100644 --- a/src/DoctrineDbalContentGraphProjection.php +++ b/src/DoctrineDbalContentGraphProjection.php @@ -248,9 +248,11 @@ public function inSimulation(\Closure $fn): mixed throw new \RuntimeException(sprintf('Invoking %s is not allowed to be invoked recursively. Current transaction nesting %d.', __FUNCTION__, $this->dbal->getTransactionNestingLevel())); } $this->dbal->beginTransaction(); + $this->dbal->setRollbackOnly(); try { return $fn(); } finally { + // unsets rollback only flag and allows the connection to work regular again $this->dbal->rollBack(); } }