Review 11.5 Merged

73055[TASK] Use proper QueryBuilder execute() replacement methods

Stefan Bürk CR +2 V +2 Expert +671 −654 updated 01/18/22, 12:44

Commit message

doctrine/dbal implemented single purpose method to replace the
compound 'execute()' in QueryBuilder to avoid the incompatible
return typehint tuple of 'Doctrine\DBAL\Result|int' in favour
of 'executeQuery()' and 'executeStatement()' which was added
forward-compatible with #96247 marking the old one internal
but not deprecated for now to keep a eventually longer grace
period to mitigate for extensions developers.

This patch however goes through the core and replace these
methods to be clean as possible and is a first preparation
to remove the 'checkThisOnly' option from phpstan which are
swallowed by this option.

* replace 'execute' with 'executeQuery()' for select and
  count queries generating results ('Doctrine\DBAL\Result').
* use 'executeStatement()' for insert, update and delete
  queries return affected rows as return value (int)
* adjust return typehints to match the single return type
  signature on really minor places to match the return type
  of the wrapped replaced execute method.
* replace one really old 'exec()' from connection with
  corresponding replacement method along the way.
* add several todos on two places which are weird and do
  not make any sense for further investigation and fixing,
  as declared as out-of-the-scope for this wide-area patch.

Review

  • Code review CR +2 Done
    • Benni Mack +2
  • Verified V +2 Done
    • Benni Mack +2
    • core-ci +1 CI

Issues 3

Files 195

Show 175 more files

Review log 45

  1. Stefan Bürk uploaded patch set 1 01/18/22, 10:11

  2. Stefan Bürk commented on patch set 1 01/18/22, 10:11

    Prepared backport. Done tasks: * git rm typo3/sysext/redirects/Classes/EventListener/IncrementHitCount.php removed with 'git rm' from cherry-pick => new in main (Feature) * solved conflicts in - typo3/sysext/backend/Classes/Search/LiveSearch/LiveSearch.php - typo3/sysext/impexp/Classes/Domain/Repository/PresetRepository.php ^^ new because of solved merged conflict on main because of impexp refactoring
  3. core-ci voted on patch set 1 V +1 01/18/22, 10:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22215

  4. Benni Mack voted on patch set 1 V +2 CR +2 01/18/22, 12:44

  5. Benni Mack merged patch set 2 01/18/22, 12:44