Skip to content

Commit 154d45f

Browse files
authored
[TASK] Move service aliases from DI to services chapter (#5257)
1 parent eff7827 commit 154d45f

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

Documentation/ApiOverview/DependencyInjection/Index.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Potencier. Whenever a :ref:`service <cgl-services>` has a *service dependency* t
3434
class, the technique of *dependency injection* should be used to satisfy that need. TYPO3
3535
uses a Symfony component for dependency injection. The component is `PSR-11
3636
<https://www.php-fig.org/psr/psr-11/>`_ compliant, and is used throughout
37-
core and extensions to standardize the process of obtaining services dependencies.
37+
core and extensions to standardize the process of obtaining service dependencies.
3838

3939
By default all API services shipped with the TYPO3 Core system extensions offer dependency
4040
injection. The recommended usage is :ref:`constructor injection
@@ -130,9 +130,7 @@ a single cache file just once, and afterwards no expensive calculation is requir
130130
for actual creation.
131131

132132
Symfony based DI was implemented in TYPO3 v10 and usage of the Extbase
133-
ObjectManager was discouraged. With TYPO3 v11 the core doesn't use the
134-
ObjectManager any more. It is actively deprecated in v11 and thus leads to
135-
'deprecation' level log entries.
133+
ObjectManager was discouraged.
136134

137135
The Extbase ObjectManager has been removed with TYPO3 v12. Making use of
138136
Symfony DI integration continues. There
@@ -571,17 +569,9 @@ injecting values from :file:`ext_conf_templates.txt` files using the
571569
This example demonstrates the combination of a service class with an alias and
572570
a consumer utilizing this alias in an :php:`Autowire` attribute.
573571

574-
TYPO3 core provides several service aliases, but it does not add additional aliases
575-
arbitrarily. Injecting state, as in the example above, makes services stateful,
576-
which is undesirable unless the state does not change at runtime. Aliases for
577-
services that act as shortcuts for factories, like the :php:`cache.runtime`
578-
example, will only be added for services that are used very frequently.
579-
580-
Service aliases also present backward compatibility challenges when modified.
581-
To avoid excessive clutter, TYPO3 core limits the number of service aliases.
582-
Developers needing aliases for core services can always add them in
583-
instance-specific extensions. The inclusion of such aliases in TYPO3 core will
584-
remain a case-by-case decision.
572+
The TYPO3 core provides a couple such service aliases, with the above ones being
573+
the most important ones for extension developers. TYPO3 core does
574+
:ref:`not arbitrarily add <service-aliases>` aliases.
585575

586576

587577
.. _dependency-injection-installation-wide:

Documentation/PhpArchitecture/Services.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,25 @@ Bad Examples
7575
* Heavily stateful
7676

7777

78+
.. _service-aliases:
79+
80+
Service aliases
81+
===============
82+
83+
TYPO3 core provides several :ref:`service aliases <dependency-injection-autowire>`, but
84+
it does not add additional aliases arbitrarily. Injecting state, as in the
85+
:php:`extension-configuration` example, makes services stateful, which is undesirable
86+
unless the state does not change at runtime. Aliases for services that act as shortcuts
87+
for factories, like the :php:`cache.runtime` example, will only be added for services
88+
that are used very frequently.
89+
90+
Service aliases also present backward compatibility challenges when modified.
91+
To avoid excessive clutter, TYPO3 core limits the number of service aliases.
92+
Developers needing aliases for core services can always add them in
93+
instance-specific extensions. The inclusion of such aliases in TYPO3 core will
94+
remain a case-by-case decision.
95+
96+
7897
Further Reading
7998
===============
8099

0 commit comments

Comments
 (0)