diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index f714af9f2a4..623c09142d2 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -1667,9 +1667,6 @@ public function transactional(Closure $func) $this->beginTransaction(); try { $res = $func($this); - $this->commit(); - - return $res; } catch (Throwable $e) { $this->rollBack(); @@ -1791,7 +1788,7 @@ public function commit() } catch (Throwable $ex) { $this->updateTransactionStateAfterCommit(); - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, 'COMMIT'); + $this->handleExceptionDuringQuery($ex, 'COMMIT'); } if ($logger) { @@ -1809,19 +1806,19 @@ public function commit() } $this->updateTransactionStateAfterCommit(); + + return $result; } - private function updateTransactionStateAfterCommit() : void + private function updateTransactionStateAfterCommit(): void { --$this->transactionNestingLevel; if ($this->autoCommit !== false || $this->transactionNestingLevel !== 0) { - return $result; + return; } $this->beginTransaction(); - - return $result; } /**