Skip to content

Commit

Permalink
[doctrineGH-3088] Deprecate usage of PDO Fetch Mode and Param constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 22, 2021
1 parent 705d3a2 commit f33960f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/Doctrine/DBAL/Driver/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType;
use Doctrine\Deprecations\Deprecation;
use PDO;
use PDOException;

use function array_slice;
use function assert;
use function func_get_args;
use function is_array;
use function sprintf;
use function trigger_error;

use const E_USER_DEPRECATED;

/**
* The PDO implementation of the Statement interface.
Expand Down Expand Up @@ -274,10 +271,13 @@ private function convertParamType(int $type): int
{
if (! isset(self::PARAM_TYPE_MAP[$type])) {
// TODO: next major: throw an exception
@trigger_error(sprintf(
'Using a PDO parameter type (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0',
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3088',
'Using a PDO parameter type (%d given) is deprecated, ' .
'use \Doctrine\DBAL\Types\Types constants instead.',
$type
), E_USER_DEPRECATED);
);

return $type;
}
Expand All @@ -293,12 +293,13 @@ private function convertParamType(int $type): int
private function convertFetchMode(int $fetchMode): int
{
if (! isset(self::FETCH_MODE_MAP[$fetchMode])) {
// TODO: next major: throw an exception
@trigger_error(sprintf(
'Using a PDO fetch mode or their combination (%d given)' .
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3088',
'Using an unsupported PDO fetch mode or a bitmask of fetch modes (%d given)' .
' is deprecated and will cause an error in Doctrine DBAL 3.0',
$fetchMode
), E_USER_DEPRECATED);
);

return $fetchMode;
}
Expand Down

0 comments on commit f33960f

Please sign in to comment.