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 Jul 27, 2023
1 parent 582e655 commit 0f43b5c
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 @@ -115,6 +115,8 @@ public function __construct(
$this->dbDataCollector->setDebugStack($debugStack);
$this->_config->setSQLLogger($debugStack);
}

$this->setNestTransactionsWithSavepoints(true);
}

/**
Expand Down

0 comments on commit 0f43b5c

Please sign in to comment.