Skip to content
Snippets Groups Projects
Commit 9baf7a4f authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Avoid direct usages to Doctrine/DBAL and ext-pdo

This change modifies most of the userland code to use

a) Connection::PARAM_* constants instead of \PDO::PARAM_* constants

This is due to also another change from Doctrine DBAL 3

https://github.com/doctrine/dbal/blob/3.4.x/UPGRADE.md#bc-break-the-pdo-symbols-are-no-longer-part-of-the-dbal-api

which can easily be changed in TYPO3's Source Code to ensure easy
upgrade paths and showing best practices for extension authors
looking into TYPO3 Source Code

b) Avoid using constants from \Doctrine\DBAL\Connection
but use our own constants.

Even though Doctrine DBAL 3.x introduces "ParameterType" objects,
we use our own connection implementation for the time being
as we also seek to backport such changes in TYPO3 v11.

The initial change was made with Rector - thanks to @schreiberten

    $rectorConfig->ruleWithConfiguration(
        \Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector::class,
        [
            new \Rector\Renaming\ValueObject\RenameClassAndConstFetch(
                \PDO::class,
                'PARAM_INT',
                \TYPO3\CMS\Core\Database\Connection::class,
                'PARAM_INT'
            ),
        ....

PDO constants are now solely used within our own Database adapter code.

Resolves: #98649
Releases: main, 11.5
Change-Id: I6821093e39fd553ff9589c3740d36f59c1eef51a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76157


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 2e7e438f
Showing
with 119 additions and 105 deletions
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