Skip to content

Commit f3e971a

Browse files
committed
[doctrineGH-3554] Trigger deprecation for passing user provided PDO instance.
1 parent d314a78 commit f3e971a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Doctrine/DBAL/DriverManager.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Doctrine\DBAL\Driver\PDO;
1111
use Doctrine\DBAL\Driver\SQLAnywhere;
1212
use Doctrine\DBAL\Driver\SQLSrv;
13+
use Doctrine\Deprecations\Deprecation;
1314

1415
use function array_keys;
1516
use function array_merge;
@@ -217,6 +218,12 @@ public static function getConnection(
217218
}
218219

219220
if (isset($params['pdo'])) {
221+
Deprecation::trigger(
222+
'doctrine/dbal',
223+
'https://github.com/doctrine/dbal/pull/3554',
224+
'Passing a user provided PDO instance directly to Doctrine is deprecated.'
225+
);
226+
220227
$params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
221228
$params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME);
222229
}

0 commit comments

Comments
 (0)