Unverified Commit 78abf390 authored by Philipp Cordes's avatar Philipp Cordes Committed by Michael Moravec

Allow using PDO-only fetch modes for now

Other drivers (including the cache) never supported fetch modes that are
not listed in `FetchMode`. Converting between the contants is only done
for PDO, so BC only needs to be restored here. PDO will validate the
fetch mode, we don’t have to.
parent 9beff5ef
...@@ -22,6 +22,9 @@ namespace Doctrine\DBAL\Driver; ...@@ -22,6 +22,9 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use PDO; use PDO;
use const E_USER_DEPRECATED;
use function sprintf;
use function trigger_error;
/** /**
* The PDO implementation of the Statement interface. * The PDO implementation of the Statement interface.
...@@ -231,7 +234,14 @@ class PDOStatement extends \PDOStatement implements Statement ...@@ -231,7 +234,14 @@ class PDOStatement extends \PDOStatement implements Statement
} }
if (! isset(self::FETCH_MODE_MAP[$fetchMode])) { if (! isset(self::FETCH_MODE_MAP[$fetchMode])) {
throw new \InvalidArgumentException('Invalid fetch mode: ' . $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 3.0',
$fetchMode
), E_USER_DEPRECATED);
return $fetchMode;
} }
return self::FETCH_MODE_MAP[$fetchMode]; return self::FETCH_MODE_MAP[$fetchMode];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment