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 <tcit@tcit.fr>
  • Loading branch information
tcitworld authored and AndyScherzinger committed Feb 27, 2024
1 parent 250084f commit 2a08154
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 @@ -127,6 +127,8 @@ public function __construct(
$this->dbDataCollector->setDebugStack($debugStack);
$this->_config->setSQLLogger($debugStack);
}

$this->setNestTransactionsWithSavepoints(true);
}

/**
Expand Down

0 comments on commit 2a08154

Please sign in to comment.