Commit 18e742c8 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Migrate more Doctrine API to be Doctrine 3.0 compatible

Resolves: #94690
Releases: master
Change-Id: I341b73f0c8782c75ca3c4bcf5a7038e6a86fc5dd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70127

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 9d7e4758
......@@ -1550,7 +1550,7 @@ TCAdefaults.sys_note.email = ' . $this->user['email'];
)
->setMaxResults(1)
->execute()
->fetch(\PDO::FETCH_ASSOC);
->fetchAssociative();
$readOnlyMountPointArray = GeneralUtility::trimExplode(',', $readOnlyMountPoints);
foreach ($readOnlyMountPointArray as $readOnlyMountPoint) {
......@@ -1977,7 +1977,7 @@ TCAdefaults.sys_note.email = ' . $this->user['email'];
->orderBy('title')
->setMaxResults(1)
->execute()
->fetch(\PDO::FETCH_ASSOC);
->fetchAssociative();
}
}
}
......
......@@ -17,7 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Database\Query\Expression;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use TYPO3\CMS\Core\Database\Connection;
/**
......@@ -511,7 +511,7 @@ class ExpressionBuilder
* @param string $char Character to be trimmed (defaults to space)
* @return string
*/
public function trim(string $fieldName, int $position = AbstractPlatform::TRIM_UNSPECIFIED, string $char = null)
public function trim(string $fieldName, int $position = TrimMode::UNSPECIFIED, string $char = null)
{
return $this->connection->getDatabasePlatform()->getTrimExpression(
$this->connection->quoteIdentifier($fieldName),
......
......@@ -47,7 +47,7 @@ class SchemaColumnDefinitionListener
$column = $this->getEnumerationTableColumnDefinition(
$tableColumn,
$event->getDatabasePlatform()
$event->getConnection()->getDatabasePlatform()
);
$event->setColumn($column);
......
......@@ -16,7 +16,6 @@
namespace TYPO3\CMS\Core\Utility;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\FetchMode;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Database\Connection;
......@@ -529,7 +528,7 @@ class RootlineUtility
->setMaxResults(1)
->execute();
$record = $statement->fetch(FetchMode::ASSOCIATIVE);
$record = $statement->fetchAssociative();
return $record ?: null;
}
......
......@@ -17,7 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Unit\Database\Query\Expression;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
use TYPO3\CMS\Core\Database\Connection;
......@@ -585,22 +585,22 @@ class ExpressionBuilderTest extends UnitTestCase
{
return [
'trim leading character' => [
AbstractPlatform::TRIM_LEADING,
TrimMode::LEADING,
'x',
'TRIM(LEADING "x" FROM "tableName"."fieldName")'
],
'trim trailing character' => [
AbstractPlatform::TRIM_TRAILING,
TrimMode::TRAILING,
'x',
'TRIM(TRAILING "x" FROM "tableName"."fieldName")',
],
'trim character' => [
AbstractPlatform::TRIM_BOTH,
TrimMode::BOTH,
'x',
'TRIM(BOTH "x" FROM "tableName"."fieldName")',
],
'trim space' => [
AbstractPlatform::TRIM_BOTH,
TrimMode::BOTH,
' ',
'TRIM(BOTH " " FROM "tableName"."fieldName")',
]
......
......@@ -17,7 +17,6 @@ declare(strict_types=1);
namespace TYPO3\CMS\FrontendLogin\Domain\Repository;
use Doctrine\DBAL\FetchMode;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
......@@ -149,7 +148,7 @@ class FrontendUserRepository
)
)
;
$result = $query->execute()->fetch(FetchMode::ASSOCIATIVE);
$result = $query->execute()->fetchAssociative();
if (!is_array($result)) {
$result = [];
}
......
......@@ -188,8 +188,7 @@ class MySql extends AbstractPlatform
*/
protected function getIncompatibleSqlModes(Connection $connection): array
{
$sqlModes = explode(',', $connection->executeQuery('SELECT @@SESSION.sql_mode;')
->fetch(0)['@@SESSION.sql_mode']);
$sqlModes = explode(',', (string)$connection->executeQuery('SELECT @@SESSION.sql_mode;')->fetchOne());
return array_intersect($this->incompatibleSqlModes, $sqlModes);
}
......
......@@ -95,7 +95,7 @@ class SqlSrv extends AbstractPlatform
[$connection->getDatabase()],
[\PDO::PARAM_STR]
)
->fetch(\PDO::FETCH_NUM);
->fetchNumeric();
foreach ($this->databaseCharsetToCheck as $databaseCharsetToCheck) {
if (!stripos($defaultDatabaseCharset[0], $databaseCharsetToCheck)) {
......@@ -125,7 +125,7 @@ class SqlSrv extends AbstractPlatform
public function checkDefaultDatabaseServerCharset(Connection $connection): void
{
$defaultServerCharset = $connection->executeQuery('SELECT SERVERPROPERTY(\'Collation\')')
->fetch(\PDO::FETCH_NUM);
->fetchNumeric();
foreach ($this->databaseServerCharsetToCheck as $databaseServerCharsetToCheck) {
// is charset part of collation
......
......@@ -77,7 +77,7 @@ class PreviewUserAuthentication extends BackendUserAuthentication
->orderBy('title')
->setMaxResults(1)
->execute()
->fetch(\PDO::FETCH_ASSOC);
->fetchAssociative();
}
}
// If the workspace exists in the database, the preview user is automatically a member to that workspace
......
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