1 .. include:: ../../Includes.txt
3 ===========================================================================
4 Deprecation: #82975 - Deprecate usage of @inject with non-public properties
5 ===========================================================================
12 When using private or protected properties for Dependency Injection via :php:`@inject`, Extbase needs to
13 use the object reflection API to make these properties settable from the outside,
14 which is quite slow and cannot be cached in any way. Therefore property injection should
15 only work for public properties.
21 Using :php:`@inject` with a non-public property will trigger a deprecation warning and will
22 not work any longer in TYPO3 version 10.
25 Affected Installations
26 ======================
28 All installations, that use property injection via :php:`@inject` with non-public properties
34 You have the following options to migrate:
36 - Introduce an explicit :php:`inject*()` method (e.g. :php:`injectMyProperty()`)
37 - Use constructor injection
38 - Make the property public (think about whether this is desired in terms of software design)
41 An inject method would look like this:
46 * @var MyFancyProperty $myFancyProperty
48 private $myFancyProperty;
51 * @param MyFancyProperty $myFancyProperty
53 public function injectMyFancyProperty(MyFancyProperty $myFancyProperty): void
55 $this->myFancyProperty = $myFancyProperty;
58 .. index:: PHP-API, ext:extbase, NotScanned