Review 13.4 Merged

87928[BUGFIX] Allow extbase persistence layer without ServerRequest

Christian Kuhn CR +2 V +2 Normal +142 −50 updated 01/29/25, 17:03

Commit message

Extbase in general has a rather hard dependency to PSR-7 Request,
in particular through the ConfigurationManager. This is usually
initialized in extbase bootstrap when extbase runs as a standard
content element in FE, and similar when run as BE module.

This has been hardened in v12 and v13, making clear that key code
like controller action handling and views can not run without
a Request being set.

Some other parts - namely the persistence layer - however reduced
its dependency to Request (and TypoScript) at the same time: The
dependency to TypoScript has been removed in the model mapping
configuration and is PHP based since TYPO3 v10.

The default persistence currently only fetches the toggle whether
reference index should be updated from TypoScript configuration.
This setting however should be removed since the reference index
becomes more and more important with recent core versions and
extbase should usually *always* keep the refindex updated. The
other configuration setting used from TypoScript is "storagePid".
We probably won't get rid of this anytime soon, but we can at
least make it fallback to pid 0 for now.

The patch aims to optionally run the extbase persistence layer
without a request being set to ConfigurationManager. To be able
to use this part of Extbase in contexts without a fully bootstrapped
configuration manager, try..catch blocks have been introduced which
catch a newly introduced `NoServerRequestGivenException`.

Sane fallback values are then used:
* Reference index will always be updated
* Storage page id will be 0

The reference index behavior is not configurable otherwise but
the storage page can be overridden during writes by setting the
`$pid` property of the respective entity.

During reads, users can explicitly override the query settings
and define custom storage page ids to read from or choose to
not take any storage page into consideration.

The patch implements the changes and cleans up surrounding code
slightly. The ConfigurationManager now throws a specific exception
that can be caught, this was a \RuntimeException before. Catching
global exceptions is bad practice, `NoServerRequestGivenException`
extends basic `Extbase\Exception` in v14, not `\RuntimeException`,
which is not considered breaking. The v13 version of the patch
will extend `\RuntimeException` though, to not break any existing
v13 instance that may currently catch `\RuntimeException`.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
  • Verified V +2 Done
    • Christian Kuhn +2
    • core-ci +1 CI

Issues 1

Files 7

Review log 46

  1. Christian Kuhn uploaded patch set 1 01/29/25, 16:20

  2. core-ci voted on patch set 1 V +1 01/29/25, 16:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73148

  3. Christian Kuhn uploaded patch set 2 V +1 01/29/25, 16:38

  4. core-ci voted on patch set 2 V +1 01/29/25, 16:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73150

  5. Christian Kuhn voted on patch set 2 CR +2 V +2 01/29/25, 17:03

  6. Christian Kuhn merged patch set 3 01/29/25, 17:03