diff --git a/lib/Doctrine/DBAL/Driver/AbstractException.php b/lib/Doctrine/DBAL/Driver/AbstractException.php index 65a9708ad65..e1965429c29 100644 --- a/lib/Doctrine/DBAL/Driver/AbstractException.php +++ b/lib/Doctrine/DBAL/Driver/AbstractException.php @@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Driver; +use Doctrine\Deprecations\Deprecation; use Exception as BaseException; /** @@ -47,6 +48,12 @@ public function __construct($message, $sqlState = null, $errorCode = null) */ public function getErrorCode() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4112', + 'Driver\AbstractException::getErrorCode() is deprecated, use getSQLState() or getCode() instead.' + ); + return $this->errorCode; } diff --git a/lib/Doctrine/DBAL/Driver/PDOException.php b/lib/Doctrine/DBAL/Driver/PDOException.php index b2c01eb4430..2d658db3aa9 100644 --- a/lib/Doctrine/DBAL/Driver/PDOException.php +++ b/lib/Doctrine/DBAL/Driver/PDOException.php @@ -3,6 +3,7 @@ namespace Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\PDO\Exception; +use Doctrine\Deprecations\Deprecation; /** * @deprecated Use {@link Exception} instead @@ -43,6 +44,12 @@ public function __construct(\PDOException $exception) */ public function getErrorCode() { + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/4112', + 'Driver\AbstractException::getErrorCode() is deprecated, use getSQLState() or getCode() instead.' + ); + return $this->errorCode; }