Review main Merged

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

Benni Mack CR +2 V +2 Expert +898 −811 updated 11/20/22, 14:57

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.

c) Avoid using the Connection::PARAM_STR for ->createNamedParameter
as second argument, as this is the default value.

All of these changes will make the upgrade path towards Doctrine
DBAL 4.x easier.

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 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 160

Show 140 more files

Review log 1012

  1. Benni Mack uploaded patch set 1 10/18/22, 09:28

  2. core-ci voted on patch set 1 V +1 10/18/22, 09:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/32426

  3. Stefan Bürk voted on patch set 1 V +1 CR +1 10/18/22, 09:56

  4. Stefan Bürk commented on patch set 1 CR -1 10/18/22, 10:33

    Issue number missing
  5. Benni Mack updated the commit message in patch set 2 10/18/22, 10:50

  6. core-ci voted on patch set 2 V +1 10/18/22, 10:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/32431

  7. Stefan Bürk voted on patch set 2 V +1 CR +1 10/18/22, 11:00

  8. Oliver Klee voted on patch set 2 V +1 10/18/22, 11:16

  9. Oliver Klee voted on patch set 2 CR +1 10/18/22, 11:47

  10. Benni Mack voted on patch set 2 V +2 CR +2 10/18/22, 13:17

  11. Benni Mack merged patch set 3 10/18/22, 13:17

  12. Stefan Bürk commented on patch set 3 11/20/22, 14:57

    11.5 backport has been done manually with dedicated change id in: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76157