Review 11.5 Merged

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

Benni Mack CR +2 V +2 Expert +928 −831 updated 10/19/22, 11:12

Commit message

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.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 165

Show 145 more files