Unverified Commit 4cb9e36d authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #4118 from morozov/deprecate-exception-converter

Deprecate ExceptionConverterDriver
parents 7e45a379 4b445ae7
# 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.
......
......@@ -4,6 +4,8 @@ namespace Doctrine\DBAL\Driver;
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;
......@@ -39,4 +41,14 @@ abstract class AbstractDB2Driver implements Driver
{
return new DB2SchemaManager($conn);
}
/**
* @param string $message
*
* @return DriverException
*/
public function convertException($message, TheDriverException $exception)
{
return new DriverException($message, $exception);
}
}
......@@ -5,6 +5,8 @@ namespace Doctrine\DBAL\Driver;
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;
......@@ -92,4 +94,14 @@ abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDr
{
return new SQLServerSchemaManager($conn);
}
/**
* @param string $message
*
* @return DriverException
*/
public function convertException($message, TheDriverException $exception)
{
return new DriverException($message, $exception);
}
}
......@@ -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
{
......
......@@ -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>
......
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