sabbelasichon / typo3-rector

Rector for TYPO3
MIT License
228 stars 63 forks source link

Deprecation: #94619 - Extbase ObjectManager #2614

Closed sabbelasichon closed 3 years ago

sabbelasichon commented 3 years ago

Deprecation: #94619 - Extbase ObjectManager

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/11.4/Deprecation-94619-ExtbaseObjectManager.html .. include:: ../../Includes.txt

=========================================== Deprecation: #94619 - Extbase ObjectManager

See :issue:94619

Description

The Extbase ObjectManager as the legacy core object lifecycle and dependency injection solution has been marked discouraged with TYPO3 v10 and its introduction of the Symfony based dependency injection solution already.

TYPO3 v11 no longer uses the Extbase ObjectManager - only in a couple of places as fallback for third party extensions. The entire construct has now been marked as deprecated and will be removed with v12:

Impact

Directly or indirectly calling :php:\TYPO3\CMS\Extbase\Object\ObjectManager->get() will trigger a PHP :php:E_USER_DEPRECATED error.

Affected Installations

Extensions that have been properly cleaned up for TYPO3 v10 compatibility are not affected.

Extensions still relying on Extbase ObjectManager are strongly encouraged to switch to :php:\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance() and Symfony based DI instead.

The extension scanner will find usages of the above classes and interfaces and shows them as deprecated with a strong match.

Migration

Documentation of migration paths have been established with TYPO3 v10 documentation already. The :ref:TYPO3 explained dependency injection section<t3coreapi:DependencyInjection> and the :ref:ObjectManager->get() v10 changelog entry <changelog-Deprecation-90803-ObjectManagerGet> are especially helpful.

.. index:: PHP-API, FullyScanned, ext:extbase

sabbelasichon commented 3 years ago

Cross post https://github.com/sabbelasichon/typo3-rector/issues/2454