Skip to content

Commit b435fc6

Browse files
committed
fix deprecations for deprecated mysql server versions
1 parent 1a3505d commit b435fc6

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

src/ConnectionFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ public function createConnection(array $params, ?Configuration $config = null, ?
120120
$driver = $connection->getDriver();
121121
/** @psalm-suppress InvalidScalarArgument Bogus error, StaticServerVersionProvider implements Doctrine\DBAL\ServerVersionProvider */
122122
$platform = $driver->getDatabasePlatform(
123-
...(class_exists(StaticServerVersionProvider::class) ? [new StaticServerVersionProvider($params['serverVersion'] ?? '')] : []),
123+
...(class_exists(StaticServerVersionProvider::class)
124+
? [new StaticServerVersionProvider($params['serverVersion'] ?? $params['primary']['serverVersion'] ?? '')]
125+
: []
126+
),
124127
);
125128

126129
if (! isset($params['charset'])) {

tests/ConnectionFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testDefaultCharsetNonMySql(): void
4343
public function testDefaultCharsetMySql(): void
4444
{
4545
$factory = new ConnectionFactory([]);
46-
$params = ['driver' => 'pdo_mysql'];
46+
$params = ['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'];
4747

4848
$connection = $factory->createConnection($params, $this->configuration);
4949

@@ -53,7 +53,7 @@ public function testDefaultCharsetMySql(): void
5353
public function testDefaultCollationMySql(): void
5454
{
5555
$factory = new ConnectionFactory([]);
56-
$connection = $factory->createConnection(['driver' => 'pdo_mysql'], $this->configuration);
56+
$connection = $factory->createConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.0.31'], $this->configuration);
5757

5858
$this->assertSame(
5959
'utf8mb4_unicode_ci',

tests/DependencyInjection/Fixtures/config/xml/dbal_schema_filter.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
<config>
1010
<dbal default-connection="connection1">
11-
<connection name="connection1" schema-filter="~^(?!t_)~" />
12-
<connection name="connection2" />
13-
<connection name="connection3" />
11+
<connection name="connection1" schema-filter="~^(?!t_)~" server-version="8.0.31" />
12+
<connection name="connection2" server-version="8.0.31" />
13+
<connection name="connection3" server-version="8.0.31" />
1414
</dbal>
1515
</config>
1616
</srv:container>

tests/DependencyInjection/Fixtures/config/xml/orm_filters.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<config>
1010
<dbal default-connection="default">
11-
<connection name="default" dbname="db" />
11+
<connection name="default" dbname="db" server-version="8.0.31" />
1212
</dbal>
1313

1414
<orm enable-lazy-ghost-objects="true">

tests/DependencyInjection/Fixtures/config/yml/dbal_schema_filter.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ doctrine:
44
connections:
55
connection1:
66
schema_filter: ~^(?!t_)~
7-
connection2: []
8-
connection3: []
7+
server_version: 8.0.31
8+
connection2:
9+
server_version: 8.0.31
10+
connection3:
11+
server_version: 8.0.31

tests/DependencyInjection/Fixtures/config/yml/orm_filters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ doctrine:
44
connections:
55
default:
66
dbname: db
7+
server_version: 8.0.31
78

89
orm:
910
enable_lazy_ghost_objects: true

0 commit comments

Comments
 (0)