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 37c6000
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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
1 change: 0 additions & 1 deletion tests/Functional/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ doctrine:
replica:
url: '%database.url%'
server_version: 8.0.31
use_savepoints: true
replicas:
replica_one:
url: '%database.url%'
Expand Down

0 comments on commit 37c6000

Please sign in to comment.