Mark Connection::getParams() internal

parent 2cfd54ae
# Upgrade to 2.11 # Upgrade to 2.11
## `Connection::getParams()` has been marked internal
Consumers of the Connection class should not rely on connection parameters stored in the connection object. If needed, they should be obtained from a different source, e.g. application configuration.
## Deprecated `Doctrine\DBAL\Driver::getDatabase()` ## Deprecated `Doctrine\DBAL\Driver::getDatabase()`
- The usage of `Doctrine\DBAL\Driver::getDatabase()` is deprecated. Please use `Doctrine\DBAL\Connection::getDatabase()` instead. - The usage of `Doctrine\DBAL\Driver::getDatabase()` is deprecated. Please use `Doctrine\DBAL\Connection::getDatabase()` instead.
......
...@@ -225,6 +225,8 @@ class Connection implements DriverConnection ...@@ -225,6 +225,8 @@ class Connection implements DriverConnection
/** /**
* Gets the parameters used during instantiation. * Gets the parameters used during instantiation.
* *
* @internal
*
* @return mixed[] * @return mixed[]
*/ */
public function getParams() public function getParams()
...@@ -1199,7 +1201,7 @@ class Connection implements DriverConnection ...@@ -1199,7 +1201,7 @@ class Connection implements DriverConnection
throw CacheException::noResultDriverConfigured(); throw CacheException::noResultDriverConfigured();
} }
$connectionParams = $this->getParams(); $connectionParams = $this->params;
unset($connectionParams['platform']); unset($connectionParams['platform']);
[$cacheKey, $realKey] = $qcp->generateCacheKeys($query, $params, $types, $connectionParams); [$cacheKey, $realKey] = $qcp->generateCacheKeys($query, $params, $types, $connectionParams);
......
...@@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Id; ...@@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Id;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\LockMode; use Doctrine\DBAL\LockMode;
use Throwable; use Throwable;
...@@ -69,12 +70,16 @@ class TableGenerator ...@@ -69,12 +70,16 @@ class TableGenerator
*/ */
public function __construct(Connection $conn, $generatorTableName = 'sequences') public function __construct(Connection $conn, $generatorTableName = 'sequences')
{ {
$params = $conn->getParams(); if ($conn->getDriver() instanceof Driver\PDOSqlite\Driver) {
if ($params['driver'] === 'pdo_sqlite') {
throw new DBALException('Cannot use TableGenerator with SQLite.'); throw new DBALException('Cannot use TableGenerator with SQLite.');
} }
$this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager()); $this->conn = DriverManager::getConnection(
$conn->getParams(),
$conn->getConfiguration(),
$conn->getEventManager()
);
$this->generatorTableName = $generatorTableName; $this->generatorTableName = $generatorTableName;
} }
......
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