Skip to content

Commit d5da8b4

Browse files
authored
Merge pull request #5699 from morozov/deprecate-connection-platform
Deprecate platform parameter of wrapper Connection
2 parents 6bad1f2 + f208fed commit d5da8b4

File tree

3 files changed

+18
-36
lines changed

3 files changed

+18
-36
lines changed

UPGRADE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ awareness about deprecated code.
88

99
# Upgrade to 3.5
1010

11+
## Deprecated the "platform" parameter of the wrapper `Connection`.
12+
13+
The "platform" parameter of the wrapper `Connection` has been deprecated. Use a driver middleware that would instantiate
14+
the platform instead.
15+
1116
## Deprecated driver name aliases.
1217

1318
Relying on driver name aliases in connection parameters has been deprecated. Use the actual driver names instead.

docs/en/reference/configuration.rst

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -278,45 +278,15 @@ Automatic platform version detection
278278

279279
Doctrine ships with different database platform implementations for some vendors
280280
to support version specific features, dialect and behaviour.
281-
As of Doctrine DBAL 2.5 the appropriate platform implementation for the underlying
282-
database server version can be detected at runtime automatically for nearly all drivers.
283-
Before 2.5 you had to configure Doctrine to use a certain platform implementation
284-
explicitly with the ``platform`` connection parameter (see section below).
285-
Otherwise Doctrine always used a default platform implementation. For example if
286-
your application was backed by a SQL Server 2012 database, Doctrine would still use
287-
the SQL Server 2008 platform implementation as it is the default, unless you told
288-
Doctrine explicitly to use the SQL Server 2012 implementation.
289-
290-
The following drivers support automatic database platform detection out of the box
291-
without any extra configuration required:
292-
293-
- ``pdo_mysql``
294-
- ``mysqli``
295-
- ``pdo_pgsql``
296-
- ``pdo_sqlsrv``
297-
- ``sqlsrv``
298-
299-
Some drivers cannot provide the version of the underlying database server without
300-
having to query for it explicitly.
301-
302-
If you still want to tell Doctrine which database server version you are using in
303-
order to choose the appropriate platform implementation, you can pass the
304-
``serverVersion`` option with a vendor specific version string that matches the
305-
database server version you are using.
306-
You can also pass this option if you want to disable automatic database platform
307-
detection for a driver that natively supports it and choose the platform version
308-
implementation explicitly.
309281

310-
If you are running a MariaDB database, you should prefix the ``serverVersion``
311-
with ``mariadb-`` (ex: ``mariadb-10.2.12``).
282+
The drivers will automatically detect the platform version and instantiate
283+
the corresponding platform class.
312284

313-
Custom Platform
314-
~~~~~~~~~~~~~~~
285+
You can also pass the ``serverVersion`` option if you want to disable automatic
286+
database platform detection and choose the platform version implementation explicitly.
315287

316-
Each built-in driver uses a default implementation of
317-
``Doctrine\DBAL\Platforms\AbstractPlatform``. If you wish to use a
318-
customized or custom implementation, you can pass a precreated
319-
instance in the ``platform`` option.
288+
If you are running a MariaDB database, you should prefix the ``serverVersion``
289+
with ``mariadb-`` (ex: ``mariadb-10.2.12``).
320290

321291
Custom Driver Options
322292
~~~~~~~~~~~~~~~~~~~~~

src/Connection.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ public function __construct(
184184
throw Exception::invalidPlatformType($params['platform']);
185185
}
186186

187+
Deprecation::trigger(
188+
'doctrine/dbal',
189+
'https://github.com/doctrine/dbal/pull/5699',
190+
'The "platform" connection parameter is deprecated.'
191+
. ' Use a driver middleware that would instantiate the platform instead.',
192+
);
193+
187194
$this->platform = $params['platform'];
188195
$this->platform->setEventManager($this->_eventManager);
189196
}

0 commit comments

Comments
 (0)