Review main Merged

64319[TASK] Provide dependency injection configuration for extbase DataMapper

Benjamin Franzke CR +2 V +2 Easy +5 −0 updated 04/28/20, 08:24

Commit message

The extbase DataMapper was changed to use constructor based
dependency injection with change #87305. The argument $query
(of type QueryInterface) was set to a nullable
and way therefore ignored by the Extbase ObjectManager.

This class is currently only used via the Extbase ObjectManager
in core. It was therefore excluded from the symfony dependency
injection and therefore never fataled during symfony DI
container build.

Symfony DI does – in contrast to extbase DI – inject nullable
constructor arguments.
That means:
Once core or an extension starts to inject this service,
injection will fail, as QueryInterface points to the Query object
which is not autowirable. (see exception below)

Note: While it is not supported that extensions inject
this internal service, we still fix this case, because the
exception is a) hard to debug und b) core may inject it in
future.

The service is also declarted to be a prototype (shared: false) as it may
contain state, as set via `setQuery`.

[1] exception thrown by symfonyduring DI compilation:
    Symfony\Component\DependencyInjection\Exception\RuntimeException:
    Cannot autowire service "TYPO3\CMS\Extbase\Persistence\Generic\Query":
    argument "$type" of method "__construct()" has no type-hint,
    you should configure its value explicitly.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 1