diff --git a/src/ConnectionFactory.php b/src/ConnectionFactory.php
index 497eab9d..2b273bdf 100644
--- a/src/ConnectionFactory.php
+++ b/src/ConnectionFactory.php
@@ -120,7 +120,10 @@ public function createConnection(array $params, ?Configuration $config = null, ?
$driver = $connection->getDriver();
/** @psalm-suppress InvalidScalarArgument Bogus error, StaticServerVersionProvider implements Doctrine\DBAL\ServerVersionProvider */
$platform = $driver->getDatabasePlatform(
- ...(class_exists(StaticServerVersionProvider::class) ? [new StaticServerVersionProvider($params['serverVersion'] ?? '')] : []),
+ ...(class_exists(StaticServerVersionProvider::class)
+ ? [new StaticServerVersionProvider($params['serverVersion'] ?? $params['primary']['serverVersion'] ?? '')]
+ : []
+ ),
);
if (! isset($params['charset'])) {
diff --git a/tests/ConnectionFactoryTest.php b/tests/ConnectionFactoryTest.php
index 40396cde..1abd9a1e 100644
--- a/tests/ConnectionFactoryTest.php
+++ b/tests/ConnectionFactoryTest.php
@@ -43,7 +43,7 @@ public function testDefaultCharsetNonMySql(): void
public function testDefaultCharsetMySql(): void
{
$factory = new ConnectionFactory([]);
- $params = ['driver' => 'pdo_mysql'];
+ $params = ['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'];
$connection = $factory->createConnection($params, $this->configuration);
@@ -53,7 +53,7 @@ public function testDefaultCharsetMySql(): void
public function testDefaultCollationMySql(): void
{
$factory = new ConnectionFactory([]);
- $connection = $factory->createConnection(['driver' => 'pdo_mysql'], $this->configuration);
+ $connection = $factory->createConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'], $this->configuration);
$this->assertSame(
'utf8mb4_unicode_ci',
diff --git a/tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml b/tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml
index 55f43326..c784ae95 100644
--- a/tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml
+++ b/tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
diff --git a/tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml b/tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml
index 5d872376..bc018dd5 100644
--- a/tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml
+++ b/tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml b/tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml
index c557507a..caf9a58b 100644
--- a/tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml
+++ b/tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml
@@ -4,5 +4,8 @@ doctrine:
connections:
connection1:
schema_filter: ~^(?!t_)~
- connection2: []
- connection3: []
+ server_version: 8.0.31
+ connection2:
+ server_version: 8.0.31
+ connection3:
+ server_version: 8.0.31
diff --git a/tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml b/tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml
index cdd80a0e..acec10b1 100644
--- a/tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml
+++ b/tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml
@@ -4,6 +4,7 @@ doctrine:
connections:
default:
dbname: db
+ server_version: 8.0.31
orm:
enable_lazy_ghost_objects: true