Review main Merged

94210[BUGFIX] Avoid PageRepository->__construct()->init() DB call

Christian Kuhn CR +2 V +2 Normal +79 −93 updated 05/30/26, 13:37

Commit message

PageRepository is a rather important yet still rather messy class.
The patch fixes a long standing todo: __construct() calls init(),
which assembles the pages enable-field and fe_group access
constraints and, for the online case, issues a database query via
getDefaultConstraints(). Constructing the object thus requires a
fully configured framework and a working database connection.

This makes PageRepository unusable as a dependency injection
constructor argument in not-yet-configured projects: DI composition
of any consuming class fails with "The requested database connection
named "Default" has not been configured."

The patch moves the constraint computation out of the constructor.
The enable-field constraint and fe_group constraint are built on
demand, and both keep using the runtime cache as before.

Review

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

Issues 1

Files 3

Review log 1116

  1. Christian Kuhn uploaded patch set 1 05/29/26, 22:50

  2. core-ci voted on patch set 1 V +1 05/29/26, 22:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102633

  3. Christian Kuhn uploaded patch set 2 V +1 05/29/26, 23:26

  4. core-ci voted on patch set 2 V +1 05/29/26, 23:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102634

  5. Christian Kuhn uploaded patch set 3 V +1 05/30/26, 00:01

  6. core-ci voted on patch set 3 V +1 05/30/26, 00:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102637

  7. Christian Kuhn updated the commit message in patch set 4 V +1 05/30/26, 00:26

  8. Christian Kuhn updated the commit message in patch set 5 05/30/26, 00:30

  9. core-ci voted on patch set 4 V +1 05/30/26, 00:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102639

  10. core-ci voted on patch set 5 V +1 05/30/26, 00:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102641

  11. Stefan Bürk voted on patch set 5 CR +1 V +1 05/30/26, 12:39

  12. Oliver Klee voted on patch set 5 V +1 05/30/26, 13:04

  13. Oliver Klee commented on patch set 5 CR +1 05/30/26, 13:07

    PageRepository.php:956

    Not blocking, and only as a drive-by modification if this change needs to be modified anyway for something else: This `@param` annotation here (and for `checkValidShortcutOfPage`) does not add anything over the native type declaration and the already very communicative parameter name. So it is redundant and should be removed in both places.
  14. Christian Kuhn commented on patch set 5 05/30/26, 13:14

    PageRepository.php:956 Reply

    true. i hope it is ok to keep it at the moment to keep votes, though. main will hopefully see a DI patch for PageRepository soon, and we can clean that up as drive-by, then.
  15. Christian Kuhn voted on patch set 5 CR +2 V +2 05/30/26, 13:15

  16. Christian Kuhn merged patch set 6 05/30/26, 13:37