Skip to content

Commit 71061f5

Browse files
chore: add compatibility layer for doctrine/dbal 3 and 4
1 parent ca818a8 commit 71061f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/Traits/LiipAcmeFixturesTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Liip\Acme\Tests\Traits;
1515

16+
use Doctrine\DBAL\Connection;
1617
use Liip\Acme\Tests\App\Entity\User;
1718
use Symfony\Bundle\FrameworkBundle\Console\Application;
1819
use Symfony\Component\Console\Tester\CommandTester;
@@ -62,7 +63,15 @@ private function resetSchema(): void
6263

6364
$manager = $this->getContainer()->get('doctrine')->getManager();
6465

66+
/** @var Connection $connection */
6567
$connection = $manager->getConnection();
68+
69+
// Doctrine DBAL 3.x deprecated query() in favor of executeQuery()
70+
if (method_exists($connection, 'executeQuery')) {
71+
$connection->executeQuery('DELETE FROM liip_user');
72+
73+
return;
74+
}
6675
$connection->query('DELETE FROM liip_user');
6776
}
6877
}

0 commit comments

Comments
 (0)