[TASK] Mark ObjectManager::get deprecated
This patch adds an @deprecated annotation to the get method of the ObjectManager class of Extbase. Both the core and users use the object manager directly to create instances of dependencies, often like this: GeneralUtility::makeInstance(ObjectManager::class) ->get(Dependency::class); This is done to create an instance of an object along with it's own dependencies. Using the object manager directly is bad practice. Mandatory dependencies should be injected via constructor injection while optional dependencies may be injected via method and property injection. In both cases however, the underlying object container takes care of the dependency injection. This patch intentionally does not add a trigger_error call as the core itself still is a bad example and uses that technique itself a lot. Version 11.0 will remove all such usages and introduce the trigger_error call for user land code until the object manager is finally removed in version 12.0. Releases: master Resolves: #90803 Change-Id: Ie7d678fbb9c3b3041a17a4216f292035cd4c9b30 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63826 Tested-by:Daniel Goerz <daniel.goerz@posteo.de> Tested-by:
TYPO3com <noreply@typo3.com> Tested-by:
Oliver Bartsch <bo@cedev.de> Tested-by:
Susanne Moog <look@susi.dev> Reviewed-by:
Oliver Klee <typo3-coding@oliverklee.de> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Susanne Moog <look@susi.dev>
Showing
- typo3/sysext/core/Documentation/Changelog/10.4/Deprecation-90803-DeprecationOfObjectManagergetInExtbaseContext.rst 170 additions, 0 deletions...n-90803-DeprecationOfObjectManagergetInExtbaseContext.rst
- typo3/sysext/extbase/Classes/Object/ObjectManager.php 3 additions, 0 deletionstypo3/sysext/extbase/Classes/Object/ObjectManager.php
- typo3/sysext/extbase/Classes/Object/ObjectManagerInterface.php 1 addition, 0 deletions.../sysext/extbase/Classes/Object/ObjectManagerInterface.php
Please register or sign in to comment