Skip to content

Commit

Permalink
[doctrineGH-4112] Add deprecation for Driver\AbstractException::getEr…
Browse files Browse the repository at this point in the history
…rorCode.
  • Loading branch information
beberlei committed Mar 6, 2021
1 parent 3fcf477 commit bb0a95c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Doctrine/DBAL/Driver/AbstractException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\DBAL\Driver;

use Doctrine\Deprecations\Deprecation;
use Exception as BaseException;

/**
Expand Down Expand Up @@ -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;
}

Expand Down
7 changes: 7 additions & 0 deletions lib/Doctrine/DBAL/Driver/PDOException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Driver;

use Doctrine\DBAL\Driver\PDO\Exception;
use Doctrine\Deprecations\Deprecation;

/**
* @deprecated Use {@link Exception} instead
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit bb0a95c

Please sign in to comment.