Project

General

Profile

Actions

Bug #91200

closed

Extbase DataMapper can not be injected because of QueryInterface constructor dependency

Added by Benjamin Franzke over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2020-04-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Found via an extension that used this (@internal) class:
https://travis-ci.org/github/evoWeb/store_finder/jobs/679799189

Note: Despite this is used by an extension, this should still be prepared in core to be usable (in core) at some point and to prevent fatal errors for extension developers.

1) Evoweb\StoreFinder\Tests\Functional\Cache\AddLocationToCacheTest::locationStoredInCacheTable with data set "zip city country only" (array('', '26165', 'City5ea5d495d1643', '', 'Country5ea5d495d1644'), array('zipcode', 'city', 'country'), array('zipcode', 'city', 'country'))
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.
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:54
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:81
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php:32
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:46
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/Compiler/Compiler.php:91
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/symfony/dependency-injection/ContainerBuilder.php:734
/home/travis/build/evoWeb/store_finder/.Build/Web/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php:132
/home/travis/build/evoWeb/store_finder/.Build/Web/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php:84
/home/travis/build/evoWeb/store_finder/.Build/Web/typo3/sysext/core/Classes/Core/Bootstrap.php:140
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/typo3/testing-framework/Classes/Core/Testbase.php:578
/home/travis/build/evoWeb/store_finder/.Build/Web/vendor/typo3/testing-framework/Classes/Core/Functional/FunctionalTestCase.php:330
/home/travis/build/evoWeb/store_finder/Tests/Functional/Cache/AddLocationToCacheTest.php:48

In this case static_info_tables was patched to contain a DI configuration and injected DataMapper, which then caused symfony DI to inspect the nullable query parameter.

This currently works in core, because a) DataMapper is never injected – it is always retrieved from the Extbase ObjectManager/Container and because b) Extbase does not inject optional arguments, while symfony DI tries to.

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #87305: Use constructor injection in DataMapperClosedAlexander Schnitzler2018-12-30

Actions
Actions #1

Updated by Benjamin Franzke over 4 years ago

  • Related to Task #87305: Use constructor injection in DataMapper added
Actions #2

Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64319

Actions #3

Updated by Benjamin Franzke over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF