Review main Merged

72478[BUGFIX] Fix deprecated functionality in Doctrine DBAL 3.x API

Benni Mack CR +2 V +2 Hard +213 −142 updated 12/07/21, 11:40

Commit message

The past changes of migrating to Doctrine DBAL 3.x
had some flaws:

* Not all changes from Doctrine DBAL 3.x was applied
* core relies on various invalid interfaces and classes, so the
  return types were wrong (also Tests used the old Statement class)
* No explicit ->execute() and ->iterateAssociative() calls
  and fetchColumn() vs. fetchOne()
* added executeQuery() and executeStatement() to QueryBuilder
  decorator class

This change adapts most places to help in migrating to Doctrine DBAL
3.x for TYPO3 v12, but also avoids some unneeded deprecations for now.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 42

Show 22 more files

Review log 2741

Show 816 earlier messages
  1. Benni Mack uploaded patch set 1 12/03/21, 11:04

  2. core-ci voted on patch set 1 V -1 12/03/21, 11:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20467

  3. Benni Mack uploaded patch set 2 12/03/21, 11:14

  4. core-ci voted on patch set 2 V -1 12/03/21, 11:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20468

  5. Oliver Klee updated the commit message in patch set 3 12/03/21, 11:55

  6. core-ci voted on patch set 3 V -1 12/03/21, 12:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20472

  7. Stefan Bürk commented on patch set 3 CR -1 12/04/21, 15:50

    on it. Note: getSchemaMigrator() => createSchemaMigrator() replacement cannot be done before doctrine/dbal:^3.2 raise, replacement method do not exists in 2.13.x thus this fails and is not backportable.
  8. Benni Mack uploaded patch set 4 12/04/21, 20:49

  9. core-ci voted on patch set 4 V -1 12/04/21, 21:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20579

  10. Benni Mack uploaded patch set 5 12/04/21, 21:10

  11. Benni Mack uploaded patch set 6 12/04/21, 21:12

  12. core-ci voted on patch set 5 V -1 12/04/21, 21:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20582

  13. core-ci voted on patch set 6 V +1 12/04/21, 21:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20583

  14. Stefan Bürk uploaded patch set 7 12/04/21, 21:32

  15. core-ci voted on patch set 7 V +1 12/04/21, 21:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20584

  16. core-ci voted on patch set 7 V -1 12/04/21, 22:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20585

  1. core-ci voted on patch set 7 V +1 12/04/21, 22:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20585

  2. Stefan Bürk uploaded patch set 8 12/04/21, 23:00

  3. core-ci voted on patch set 8 V +1 12/04/21, 23:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20588

  4. Christian Kuhn commented on patch set 8 12/04/21, 23:31

    RecordHistory.php:236

    firing a second query here is useless and the code should be refactored towards while ($row = fetchAssociative()) instead.
  5. Christian Kuhn commented on patch set 8 CR -1 12/05/21, 00:09

    important patch, but we should imho clean up various details.

    PageLayoutView.php:863

    smells fishy, or i didn't understand this.

    DataMapProcessor.php:889

    i think we should avoid this iterator and use while loops instead - first to avoid that method call here and second to streamline core code to only use one alternative instead of different ones.

    QueryBuilder.php:233

    *if* we want to add this method, we MUST have a well written comment that this *ignores* QueryRestrictionBuilder and must be used with care. maybe even @internal?!

    QueryBuilder.php:247

    same as above.

    QueryBuilder.php:719

    why?

    QueryBuilder.php:740

    why?

    QueryBuilder.php:761

    why?

    ConnectionMigrator.php:303

    good!

    DefaultTcaSchema.php:601

    was this a bug in my mm sql table creation patch or did they just rename this?

    SchemaIndexDefinitionListener.php:41

    please put $event->getConnection() into a variable and add a type hint which object it is, otherwise phpstorm says 'getServerVersion()' is private ... alternative: Refactor code to test platform and not server version.

    Typo3DbBackend.php:279

    see my other comments ... *if* we introduce that, we should comment usages - "it is ok to use executeQuery() here because ..."

    InstallerController.php:653

    must be within if() above.

    AbstractPlatform.php:72

    why? also in next files.

    DatabaseRowsUpdateWizard.php:211

    fallback to 'not an array' shouldn't happen here in this while body.

    QueryGenerator.php:1357

    imho type hint in method signature and fix callers.
  6. Stefan Bürk wrote 12/05/21, 01:19

    Removed reviewer Stefan Bürk.
  7. Benni Mack commented on patch set 8 12/05/21, 12:53

    PageLayoutView.php:863 Reply

    executeQuery is for SELECT/COUNT statements and returns a Result object as of Doctrine 2.13+. execute would return a Result|int which is not what we want in "getResult". This makes it more explicit.

    DataMapProcessor.php:889 Reply

    will do

    QueryBuilder.php:233 Reply

    Bug! will fix.

    QueryBuilder.php:247 Reply

    see above, this is used for INSERT/UPDATE and DELETE. No restrictions are in place (check ->execute()).

    QueryBuilder.php:719 Reply

    As of Doctrine 3.x, the predicates must not be empty. Imagine PageRepository with "$where_hid_del" which could be empty, and would then fail. I will document this at this place.

    QueryBuilder.php:740 Reply

    see above.

    QueryBuilder.php:761 Reply

    see above.

    DefaultTcaSchema.php:601 Reply

    will check

    AbstractPlatform.php:72 Reply

    PHPStan checks mentioned that this could be null or string. So we explicitly cast to string as isValidDatabaseName() expects a string.

    DatabaseRowsUpdateWizard.php:211 Reply

    That was also PHPstan, will double check
  8. Benni Mack uploaded patch set 9 12/06/21, 08:56

  9. Benni Mack commented on patch set 9 12/06/21, 08:57

    Typo3DbBackend.php:279 Reply

    this must be changed as the old code won't work in Doctrine 2x. it's the same logic, as this is native Doctrine DBAL code then.
  10. Benni Mack commented on patch set 9 12/06/21, 08:58

    RecordHistory.php:236 Reply

    Done

    DataMapProcessor.php:889 Reply

    Done

    QueryBuilder.php:233 Reply

    Done

    QueryBuilder.php:719 Reply

    Done

    QueryBuilder.php:761 Reply

    Done

    ConnectionMigrator.php:303 Reply

    Done

    SchemaIndexDefinitionListener.php:41 Reply

    Done

    InstallerController.php:653 Reply

    Done

    AbstractPlatform.php:72 Reply

    Done

    DatabaseRowsUpdateWizard.php:211 Reply

    Done

    QueryGenerator.php:1357 Reply

    Done
  11. core-ci voted on patch set 9 V -1 12/06/21, 08:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20622

  12. Benni Mack uploaded patch set 10 12/06/21, 09:02

  13. core-ci voted on patch set 10 V +1 12/06/21, 09:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20623

  14. Stefan Bürk uploaded patch set 11 12/06/21, 10:39

  15. core-ci voted on patch set 11 V +1 12/06/21, 10:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20627

  16. Stefan Bürk commented on patch set 11 12/06/21, 12:02

    DefaultTcaSchema.php:601 Reply

    It seems that this was a bug from the mm sql table creation patch. doctrine/dbal Column() do not have a 'size' option, only a 'length' option. At least since doctrine/dbal:2.0.0. Not researched later in dbal versions. Even some other places has already used the length option.
  17. Benni Mack commented on patch set 11 12/06/21, 12:11

    DefaultTcaSchema.php:601 Reply

    Done
  18. Christian Kuhn commented on patch set 11 CR -1 12/06/21, 15:11

    on it.
  19. Stefan Bürk uploaded patch set 12 12/06/21, 21:04

  20. core-ci voted on patch set 12 V +1 12/06/21, 21:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/20664

  21. Christian Kuhn commented on patch set 12 CR -1 12/07/21, 10:53

    on it.
  22. Christian Kuhn voted on patch set 12 V +1 CR +1 12/07/21, 11:37

  23. Stefan Bürk voted on patch set 12 V +1 CR +1 12/07/21, 11:38

  24. Benni Mack voted on patch set 12 V +2 CR +2 12/07/21, 11:39

  25. Benni Mack merged patch set 13 12/07/21, 11:40