From b5ccc7ded28e2aaa0d8d976e3cf48b99bcdd981a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= Date: Fri, 20 Oct 2023 12:14:09 +0200 Subject: [PATCH] [TASK] Replace `\PDO::PARAM_*` constants with `Connection::PARAM_*` This change replaces the `\PDO::PARAM_*` constants with the TYPO3 `\TYPO3\CMS\Core\Database\Connection::PARAM_*` alternatives. This aligns the testing-framework with the core and the communicated best-practice. Note: `doctrine/dbal 4+` dropps support for the \PDO integer constants. Using the `Connection` constants allows us to change the mapping in that class and consuming code, like extensions or this package automaticlly uses the correct enum class on upgrade. Releases: main, 7 --- .../Framework/DataHandling/ActionService.php | 13 +++++++------ Classes/Core/Functional/FunctionalTestCase.php | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Classes/Core/Functional/Framework/DataHandling/ActionService.php b/Classes/Core/Functional/Framework/DataHandling/ActionService.php index 62c123ee..d8d06a00 100644 --- a/Classes/Core/Functional/Framework/DataHandling/ActionService.php +++ b/Classes/Core/Functional/Framework/DataHandling/ActionService.php @@ -17,6 +17,7 @@ */ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\DataHandling\DataHandler; @@ -527,11 +528,11 @@ protected function getVersionedId(string $tableName, $liveUid) ->where( $queryBuilder->expr()->eq( 't3ver_oid', - $queryBuilder->createNamedParameter($liveUid, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($liveUid, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 't3ver_wsid', - $queryBuilder->createNamedParameter($workspaceId, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($workspaceId, Connection::PARAM_INT) ) ) ->executeQuery() @@ -551,19 +552,19 @@ protected function getVersionedId(string $tableName, $liveUid) ->where( $queryBuilder->expr()->eq( 'uid', - $queryBuilder->createNamedParameter($liveUid, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($liveUid, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 't3ver_wsid', - $queryBuilder->createNamedParameter($workspaceId, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter($workspaceId, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 't3ver_oid', - $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter(0, Connection::PARAM_INT) ), $queryBuilder->expr()->eq( 't3ver_state', - $queryBuilder->createNamedParameter(1, \PDO::PARAM_INT) + $queryBuilder->createNamedParameter(1, Connection::PARAM_INT) ) ) ->executeQuery() diff --git a/Classes/Core/Functional/FunctionalTestCase.php b/Classes/Core/Functional/FunctionalTestCase.php index cb22ba13..483de3ce 100644 --- a/Classes/Core/Functional/FunctionalTestCase.php +++ b/Classes/Core/Functional/FunctionalTestCase.php @@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\CMS\Core\Core\ClassLoadingInformation; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; @@ -486,7 +487,7 @@ protected function getBackendUserRecordFromDatabase(int $userId): ?array $queryBuilder->getRestrictions()->removeAll(); $result = $queryBuilder->select('*') ->from('be_users') - ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($userId, \PDO::PARAM_INT))) + ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($userId, Connection::PARAM_INT))) ->executeQuery(); return $result->fetchAssociative() ?: null; }