Skip to content

Commit

Permalink
allow not explicitly enabling savepoints with DBAL 4
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Feb 15, 2024
1 parent 7111718 commit 333dd1d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use DAMA\DoctrineTestBundle\Doctrine\Cache\Psr6StaticArrayCache;
use DAMA\DoctrineTestBundle\Doctrine\DBAL\Middleware;
use Doctrine\Common\Cache\Cache;
use Doctrine\DBAL\Connection;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
Expand Down Expand Up @@ -179,6 +180,11 @@ private function validateConnectionNames(array $configNames, array $existingName

private function hasSavepointsEnabled(Definition $connectionDefinition): bool
{
// DBAL 4 implicitly always enables savepoints
if (!method_exists(Connection::class, 'getEventManager')) {
return true;
}

foreach ($connectionDefinition->getMethodCalls() as $call) {
if ($call[0] === 'setNestTransactionsWithSavepoints' && isset($call[1][0]) && $call[1][0]) {
return true;
Expand Down

0 comments on commit 333dd1d

Please sign in to comment.