Skip to content

Commit

Permalink
[doctrineGH-2958] Added conversion of DBAL constants to PDO ones for …
Browse files Browse the repository at this point in the history
…PDOStatement
  • Loading branch information
morozov committed Dec 30, 2019
1 parent 12194b7 commit fc2814b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 72 deletions.
21 changes: 3 additions & 18 deletions lib/Doctrine/DBAL/Driver/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType;
use InvalidArgumentException;
use PDO;
use const E_USER_DEPRECATED;
use function array_slice;
use function assert;
use function func_get_args;
use function is_array;
use function sprintf;
use function trigger_error;

/**
* The PDO implementation of the Statement interface.
Expand Down Expand Up @@ -193,13 +191,7 @@ public function fetchColumn($columnIndex = 0)
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',
$type
), E_USER_DEPRECATED);

return $type;
throw new InvalidArgumentException('Invalid parameter type: ' . $type);
}

return self::PARAM_TYPE_MAP[$type];
Expand All @@ -213,14 +205,7 @@ 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)' .
' is deprecated and will cause an error in Doctrine DBAL 3.0',
$fetchMode
), E_USER_DEPRECATED);

return $fetchMode;
throw new InvalidArgumentException('Invalid fetch mode: ' . $fetchMode);
}

return self::FETCH_MODE_MAP[$fetchMode];
Expand Down
54 changes: 0 additions & 54 deletions tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php

This file was deleted.

0 comments on commit fc2814b

Please sign in to comment.