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