Skip to content

Commit

Permalink
feat(db): set Doctrine to use nest transactions with savepoints
Browse files Browse the repository at this point in the history
Using nested transactions without savepoints is actually deprecated by Doctrine:
https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/transactions.html#transaction-nesting

Without savepoints, a nested transaction can be rollbacked but not
handled properly in the "real" transaction, leading to the following
error:
Transaction commit failed because the transaction has been marked for rollback only.

Ref
#36528 (comment)
(and possibly) #38902 (comment)

Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Feb 1, 2024
1 parent 937a6a8 commit 73b4bd1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ public function __construct(
$this->dbDataCollector->setDebugStack($debugStack);
$this->_config->setSQLLogger($debugStack);
}

$this->setNestTransactionsWithSavepoints(true);
}

/**
Expand Down

0 comments on commit 73b4bd1

Please sign in to comment.