diff --git a/src/DAMA/DoctrineTestBundle/DependencyInjection/DoctrineTestCompilerPass.php b/src/DAMA/DoctrineTestBundle/DependencyInjection/DoctrineTestCompilerPass.php index ce631e6..9e7d79d 100644 --- a/src/DAMA/DoctrineTestBundle/DependencyInjection/DoctrineTestCompilerPass.php +++ b/src/DAMA/DoctrineTestBundle/DependencyInjection/DoctrineTestCompilerPass.php @@ -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; @@ -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;