Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ExceptionConverterDriver #4118

Merged
merged 1 commit into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade to 2.11

## The `ExceptionConverterDriver` interface is deprecated

All drivers will have to implement the exception conversion API.

## `DriverException::getErrorCode()` is deprecated

The `DriverException::getErrorCode()` is deprecated as redundant and inconsistently supported by drivers. Use `::getCode()` or `::getSQLState()` instead.
Expand Down
12 changes: 12 additions & 0 deletions lib/Doctrine/DBAL/Driver/AbstractDB2Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException as TheDriverException;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;

Expand Down Expand Up @@ -39,4 +41,14 @@ public function getSchemaManager(Connection $conn)
{
return new DB2SchemaManager($conn);
}

/**
* @param string $message
*
* @return DriverException
*/
public function convertException($message, TheDriverException $exception)
{
return new DriverException($message, $exception);
}
}
12 changes: 12 additions & 0 deletions lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException as TheDriverException;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
Expand Down Expand Up @@ -92,4 +94,14 @@ public function getSchemaManager(Connection $conn)
{
return new SQLServerSchemaManager($conn);
}

/**
* @param string $message
*
* @return DriverException
*/
public function convertException($message, TheDriverException $exception)
{
return new DriverException($message, $exception);
}
}
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

namespace Doctrine\DBAL\Driver;

use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException as TheDriverException;
use Doctrine\DBAL\Exception\DriverException;

/**
* Contract for a driver that is capable of converting DBAL driver exceptions into standardized DBAL driver exceptions.
*
* @deprecated All implementors of the {@link Driver} interface will have to implement this API.
*/
interface ExceptionConverterDriver
{
Expand Down
5 changes: 5 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@
<exclude-pattern>lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php</exclude-pattern>
</rule>

<!-- See https://github.com/slevomat/coding-standard/issues/770 -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<exclude-pattern>lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php</exclude-pattern>
</rule>

<!-- See https://github.com/slevomat/coding-standard/issues/1038 -->
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<exclude-pattern>tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/StatementTest.php</exclude-pattern>
Expand Down