Skip to content
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

## `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()`

- The usage of `Doctrine\DBAL\Driver::getDatabase()` is deprecated. Please use `Doctrine\DBAL\Connection::getDatabase()` instead.
Expand Down
4 changes: 3 additions & 1 deletion lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ public function __construct(
/**
* Gets the parameters used during instantiation.
*
* @internal
*
* @return mixed[]
*/
public function getParams()
Expand Down Expand Up @@ -1199,7 +1201,7 @@ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qc
throw CacheException::noResultDriverConfigured();
}

$connectionParams = $this->getParams();
$connectionParams = $this->params;
unset($connectionParams['platform']);

[$cacheKey, $realKey] = $qcp->generateCacheKeys($query, $params, $types, $connectionParams);
Expand Down
11 changes: 8 additions & 3 deletions lib/Doctrine/DBAL/Id/TableGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\LockMode;
use Throwable;
Expand Down Expand Up @@ -69,12 +70,16 @@ class TableGenerator
*/
public function __construct(Connection $conn, $generatorTableName = 'sequences')
{
$params = $conn->getParams();
if ($params['driver'] === 'pdo_sqlite') {
if ($conn->getDriver() instanceof Driver\PDOSqlite\Driver) {
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;
}

Expand Down