Do not implement driver-level interfaces by wrapper-level classes

parent 0f6b728d
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK: Changes in the wrapper-level API ancestry
The wrapper-level `Connection` and `Statement` classes no longer implement the corresponding driver-level interfaces.
## BC BREAK: Removed DBALException factory methods ## BC BREAK: Removed DBALException factory methods
The following factory methods of the DBALException class have been removed: The following factory methods of the DBALException class have been removed:
......
...@@ -16,11 +16,7 @@ interfaces are implemented by concrete drivers. For all PDO based ...@@ -16,11 +16,7 @@ interfaces are implemented by concrete drivers. For all PDO based
drivers, ``PDO`` and ``PDOStatement`` are the implementations of drivers, ``PDO`` and ``PDOStatement`` are the implementations of
these interfaces. Thus, for PDO-based drivers, a these interfaces. Thus, for PDO-based drivers, a
``Doctrine\DBAL\Connection`` wraps a ``PDO`` instance and a ``Doctrine\DBAL\Connection`` wraps a ``PDO`` instance and a
``Doctrine\DBAL\Statement`` wraps a ``PDOStatement`` instance. Even ``Doctrine\DBAL\Statement`` wraps a ``PDOStatement`` instance.
more, a ``Doctrine\DBAL\Connection`` *is a*
``Doctrine\DBAL\Driver\Connection`` and a
``Doctrine\DBAL\Statement`` *is a*
``Doctrine\DBAL\Driver\Statement``.
What does a ``Doctrine\DBAL\Connection`` or a What does a ``Doctrine\DBAL\Connection`` or a
``Doctrine\DBAL\Statement`` add to the underlying driver ``Doctrine\DBAL\Statement`` add to the underlying driver
......
...@@ -41,11 +41,10 @@ use function preg_replace; ...@@ -41,11 +41,10 @@ use function preg_replace;
use function sprintf; use function sprintf;
/** /**
* A wrapper around a Doctrine\DBAL\Driver\Connection that adds features like * A database abstraction-level connection that implements features like events, transaction isolation levels,
* events, transaction isolation levels, configuration, emulated transaction nesting, * configuration, emulated transaction nesting, lazy connecting and more.
* lazy connecting and more.
*/ */
class Connection implements DriverConnection class Connection
{ {
/** /**
* Represents an array of ints to be expanded by Doctrine SQL parsing. * Represents an array of ints to be expanded by Doctrine SQL parsing.
...@@ -757,7 +756,10 @@ class Connection implements DriverConnection ...@@ -757,7 +756,10 @@ class Connection implements DriverConnection
} }
/** /**
* {@inheritDoc} * @param mixed $input
* @param int|string $type
*
* @return mixed
*/ */
public function quote($input, $type = ParameterType::STRING) public function quote($input, $type = ParameterType::STRING)
{ {
...@@ -905,11 +907,9 @@ class Connection implements DriverConnection ...@@ -905,11 +907,9 @@ class Connection implements DriverConnection
* *
* @param string $sql The SQL statement to prepare. * @param string $sql The SQL statement to prepare.
* *
* @return Statement
*
* @throws DBALException * @throws DBALException
*/ */
public function prepare(string $sql): DriverStatement public function prepare(string $sql): Statement
{ {
return new Statement($sql, $this); return new Statement($sql, $this);
} }
...@@ -1215,7 +1215,7 @@ class Connection implements DriverConnection ...@@ -1215,7 +1215,7 @@ class Connection implements DriverConnection
} }
/** /**
* {@inheritDoc} * @return bool
*/ */
public function beginTransaction() public function beginTransaction()
{ {
...@@ -1250,7 +1250,7 @@ class Connection implements DriverConnection ...@@ -1250,7 +1250,7 @@ class Connection implements DriverConnection
} }
/** /**
* {@inheritDoc} * @return bool
* *
* @throws ConnectionException If the commit failed due to no active transaction or * @throws ConnectionException If the commit failed due to no active transaction or
* because the transaction was marked for rollback only. * because the transaction was marked for rollback only.
......
...@@ -10,9 +10,9 @@ use Doctrine\DBAL\Driver; ...@@ -10,9 +10,9 @@ use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\Connection as DriverConnection; use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\DBAL\Driver\Exception as DriverException; use Doctrine\DBAL\Driver\Exception as DriverException;
use Doctrine\DBAL\Driver\Result; use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events; use Doctrine\DBAL\Events;
use Doctrine\DBAL\Statement;
use InvalidArgumentException; use InvalidArgumentException;
use function array_rand; use function array_rand;
......
...@@ -30,9 +30,6 @@ final class Connection implements ConnectionInterface ...@@ -30,9 +30,6 @@ final class Connection implements ConnectionInterface
$this->converter = $converter; $this->converter = $converter;
} }
/**
* @return Statement
*/
public function prepare(string $sql): DriverStatement public function prepare(string $sql): DriverStatement
{ {
return new Statement( return new Statement(
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Doctrine\DBAL; namespace Doctrine\DBAL;
use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
...@@ -11,10 +10,9 @@ use Doctrine\DBAL\Types\Type; ...@@ -11,10 +10,9 @@ use Doctrine\DBAL\Types\Type;
use function is_string; use function is_string;
/** /**
* A thin wrapper around a Doctrine\DBAL\Driver\Statement that adds support * A database abstraction-level statement that implements support for logging, DBAL mapping types, etc.
* for logging, DBAL mapping types, etc.
*/ */
class Statement implements DriverStatement class Statement
{ {
/** /**
* The SQL statement. * The SQL statement.
...@@ -148,7 +146,7 @@ class Statement implements DriverStatement ...@@ -148,7 +146,7 @@ class Statement implements DriverStatement
* *
* @throws DBALException * @throws DBALException
*/ */
public function execute($params = null): DriverResult public function execute($params = null): Result
{ {
if ($params !== null) { if ($params !== null) {
$this->params = $params; $this->params = $params;
......
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