Task #90803

Mark ObjectManager::get deprecated

Added by Alexander Schnitzler 7 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2020-03-21
Due date:
% Done:

100%

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

Related issues

Related to TYPO3 Core - Bug #92484: Remove usage of ObjectManager in VH of EXT:belog Resolved 2020-10-05

Associated revisions

Revision d57e9fb1 (diff)
Added by Alexander Schnitzler 6 months ago

[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 <>
Tested-by: TYPO3com <>
Tested-by: Oliver Bartsch <>
Tested-by: Susanne Moog <>
Reviewed-by: Oliver Klee <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Susanne Moog <>

History

#1 Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 2 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/+/63826

#2 Updated by Gerrit Code Review 7 months ago

Patch set 3 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/+/63826

#3 Updated by Gerrit Code Review 7 months ago

Patch set 4 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/+/63826

#4 Updated by Gerrit Code Review 6 months ago

Patch set 5 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/+/63826

#5 Updated by Alexander Schnitzler 6 months ago

  • Target version set to 10 LTS

#6 Updated by Gerrit Code Review 6 months ago

Patch set 6 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/+/63826

#7 Updated by Gerrit Code Review 6 months ago

Patch set 7 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/+/63826

#8 Updated by Gerrit Code Review 6 months ago

Patch set 8 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/+/63826

#9 Updated by Gerrit Code Review 6 months ago

Patch set 9 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/+/63826

#10 Updated by Anonymous 6 months ago

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

#11 Updated by Benni Mack 6 months ago

  • Status changed from Resolved to Closed

#12 Updated by Georg Ringer 15 days ago

  • Related to Bug #92484: Remove usage of ObjectManager in VH of EXT:belog added

Also available in: Atom PDF