Review main Merged

87936[TASK] Break service loop in ContentFetcher

Christian Kuhn CR +2 V +2 Normal +71 −74 updated 01/30/25, 16:46

Commit message

ContentFetcher is part of the "fluid based page module".
This part of the page module is very hard to stabilize and
to maintain. We had about half a dozen patches to the
"translate button" alone, all boiling down to the fact that
the codebase complexity is so high and so convoluted that
we have a really hard time dealing with it.

Quite a few things went wrong when the surrounding class
architecture has been built. One major issue is that many
classes blend data object and service characteristics
and happily "pollute" service class constructors with
manual data. Most objects assigned to fluid are a
mixture of a service and a data object.

One particularly unfortunate detail is resolved with the
patch: ContentFetcher and PageLayoutContext know each
other - there is an object loop between the two:
ContentFetcher receives PageLayoutContext in __construct(),
parks it in a property, and PageLayoutContext creates an
instance of ContentFetcher handing over itself, and carries
it in a property around as well. ContentFetcher is in fact
a service, it shouldn't have state at all, while
PageLayoutContext is more a data object that shouldn't deal
with services.

To break this loop, the patch makes ContentFetcher readonly
and stateless: The manual constructor argument
PageLayoutContext is removed and hand over to single service
methods instead. This frees __construct() and makes it
usable for proper dependency injection of dependent services.

With the relation between these two key classes being
loosened, we can continue to look at improvements of
PageLayoutContext with additional patches to turn it into
a proper data object, and we can start looking at related
classes to further reduce complexity.

Review

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

Issues 1

Files 3

Review log 79

  1. Christian Kuhn uploaded patch set 1 01/30/25, 01:37

  2. core-ci voted on patch set 1 V +1 01/30/25, 01:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73169

  3. Christian Kuhn updated the commit message in patch set 2 V +1 01/30/25, 02:05

  4. core-ci voted on patch set 2 V +1 01/30/25, 02:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/73171

  5. Stefan Bürk voted on patch set 2 CR +1 01/30/25, 12:04

  6. Stefan Bürk voted on patch set 2 V +1 01/30/25, 13:22

  7. Andreas Kienast voted on patch set 2 CR +1 V +1 01/30/25, 16:16

  8. Christian Kuhn voted on patch set 2 CR +2 V +2 01/30/25, 16:46

  9. Christian Kuhn merged patch set 3 01/30/25, 16:46