Commit a9cf5c75 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[TASK] Replace deprecated doctrine/dbal 'getSchemaManager()'

'doctrine/dbal' 3.x deprecated the 'getSchemaManager()'
method in favour of the 'createSchemaManager()' method
on connections. This has been aligned in core with the
doctrine/dbal raise in #96287. However, two occurances
with corresponding todo comments has been overseen.

This patch replace the calls and solves the comments of
the left-overs. Additionally, unrelated wrapper method in
ext:install database checks has aligned to the same name
to avoid confusion when looking for the deprecated method.

Resolves: #97552
Related: #96287
Releases: main
Change-Id: If73e9439acdcbf89db968ba1e6db1c4d60513861
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74524

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 8d2e34ba
......@@ -1270,8 +1270,7 @@ For each website you need a TypoScript template on the main page of your website
// an invalid database name would lead to exceptions which would prevent
// changing the currently configured database.
$connection = DriverManager::getConnection($connectionParams);
// @todo: migrate to createSchemaManager() with Doctrine DBAL 3.2 requirement in TYPO3 v12.0
$databaseArray = $connection->getSchemaManager()->listDatabases();
$databaseArray = $connection->createSchemaManager()->listDatabases();
$connection->close();
// Remove organizational tables from database list
......@@ -1289,10 +1288,9 @@ For each website you need a TypoScript template on the main page of your website
$connectionParams['dbname'] = $databaseName;
$connection = DriverManager::getConnection($connectionParams);
// @todo: migrate to createSchemaManager() with Doctrine DBAL 3.2 requirement in TYPO3 v12.0
$databases[] = [
'name' => $databaseName,
'tables' => count($connection->getSchemaManager()->listTableNames()),
'tables' => count($connection->createSchemaManager()->listTableNames()),
'readonly' => false,
];
$connection->close();
......
......@@ -55,8 +55,8 @@ class PermissionsCheck
{
$this->checkCreateTable($this->testTableName);
$connection = $this->getConnection();
$schemaCurrent = $this->getSchemaManager()->createSchema();
$schemaNew = $this->getSchemaManager()->createSchema();
$schemaCurrent = $this->createSchemaManager()->createSchema();
$schemaNew = $this->createSchemaManager()->createSchema();
$schemaCurrent
->getTable($this->testTableName)
->addColumn('index_test', 'integer', ['unsigned' => true]);
......@@ -76,8 +76,8 @@ class PermissionsCheck
{
if ($this->checkCreateTable($this->testTableName)) {
$connection = $this->getConnection();
$schemaCurrent = $this->getSchemaManager()->createSchema();
$schemaNew = $this->getSchemaManager()->createSchema();
$schemaCurrent = $this->createSchemaManager()->createSchema();
$schemaNew = $this->createSchemaManager()->createSchema();
$testTable = $schemaCurrent->getTable($this->testTableName);
$testTable->addColumn('index_test', 'integer', ['unsigned' => true]);
$testTable->addIndex(['index_test'], 'test_index');
......@@ -211,7 +211,7 @@ class PermissionsCheck
->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
}
private function getSchemaManager(): AbstractSchemaManager
private function createSchemaManager(): AbstractSchemaManager
{
return $this->getConnection()->createSchemaManager();
}
......
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