Skip to content

Commit

Permalink
[doctrineGH-3507] Add deprecation triggers to errorInfo/errorCode APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 6, 2021
1 parent 051bbf3 commit edb44a3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,12 @@ public function getTransactionNestingLevel()
*/
public function errorCode()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3507',
'Connection::errorCode() is deprecated, use getCode() or getSQLState() on Exception instead.'
);

return $this->getWrappedConnection()->errorCode();
}

Expand All @@ -1592,6 +1598,12 @@ public function errorCode()
*/
public function errorInfo()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3507',
'Connection::errorInfo() is deprecated, use getCode() or getSQLState() on Exception instead.'
);

return $this->getWrappedConnection()->errorInfo();
}

Expand Down
12 changes: 12 additions & 0 deletions lib/Doctrine/DBAL/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ public function columnCount()
*/
public function errorCode()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3507',
'Connection::errorCode() is deprecated, use getCode() or getSQLState() on Exception instead.'
);

return $this->stmt->errorCode();
}

Expand All @@ -222,6 +228,12 @@ public function errorCode()
*/
public function errorInfo()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/3507',
'Connection::errorInfo() is deprecated, use getCode() or getSQLState() on Exception instead.'
);

return $this->stmt->errorInfo();
}

Expand Down

0 comments on commit edb44a3

Please sign in to comment.