Bug #88904

Extbase Annotation injection currently not supported with system-wide symfony dependency injection

Added by Daniel Goerz about 1 year ago. Updated 6 months ago.

Status:
Rejected
Priority:
Should have
Category:
System/Bootstrap/Configuration
Target version:
-
Start date:
2019-08-03
Due date:
% Done:

0%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

/**
 * @TYPO3\CMS\Extbase\Annotation\Inject
 * @var \Vendor\Extbase\Services\Service
 */
public $service;

This will no longer work when the class using this annotation is included under services resource in the Services.yaml of the extension because no support was integrated.

Annotation injection in extbase is currently deprecated for non-public properties. See:

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.0/Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.html

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Deprecation-86907-DeprecateUsageOfDependencyInjectionWithNonPublicProperties.html

However it is still supported and a decision should be made if this should be supported or/and deprecated entirely.


Related issues

Related to TYPO3 Core - Feature #88689: Support for system-wide class dependency injection, PSR-11 Closed 2019-07-05

History

#1 Updated by Daniel Goerz about 1 year ago

  • Related to Feature #88689: Support for system-wide class dependency injection, PSR-11 added

#2 Updated by Benjamin Franzke 6 months ago

  • Status changed from New to Rejected

Hey,

thanks for bringing that up.
Actually I thought property injection was already deprecated in Extbase when I add support for Symfony DI.

Alexander Schnitzler later told me that only @inject was deprecated, @TYPO3\CMS\Extbase\Annotation\Inject was still supported.

I discussed this topic with Alexander Schnitzler an we agreed that we will not add support for property injection via annotation for symfony DI.
(Note: it could theoretically be configured via Services.yaml, but it's better to migrate to constructor/setter injection)

Furthermore, as we don't have added it until TYPO3 v10 LTS, its now too late anyway.

Best Regards,
Benjamin

Also available in: Atom PDF