Skip to content

Commit 616f243

Browse files
committed
feature #12684 Add container.hot_path to built-in service tags (glickel)
This PR was merged into the 3.4 branch. Discussion ---------- Add container.hot_path to built-in service tags Related to [symfony/symfony#24872](symfony/symfony#24872) <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 1647b9a Add container.hot_path to built-in service tags
2 parents d9bd18f + 1647b9a commit 616f243

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

reference/dic_tags.rst

+22
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Tag Name Usage
2020
`assetic.templating.twig`_ Remove this service if Twig templating is disabled
2121
`auto_alias`_ Define aliases based on the value of container parameters
2222
`console.command`_ Add a command
23+
`container.hot_path`_ Add to list of always needed services
2324
`controller.argument_value_resolver`_ Register a value resolver for controller arguments such as ``Request``
2425
`data_collector`_ Create a class that collects custom data for the profiler
2526
`doctrine.event_listener`_ Add a Doctrine event listener
@@ -362,6 +363,27 @@ console.command
362363
For details on registering your own commands in the service container, read
363364
:doc:`/console/commands_as_services`.
364365

366+
container.hot_path
367+
------------------
368+
369+
.. versionadded:: 3.4
370+
371+
The ``container.hot_path`` tag was introduced in Symfony 3.4.
372+
373+
**Purpose**: Add to list of always needed services
374+
375+
This tag identifies the services that are always needed. It is only applied to
376+
a very short list of bootstrapping services (like ``router``, ``event_dispatcher``,
377+
``http_kernel``, ``request_stack``, etc.). Then, it is propagated to all dependencies
378+
of these services, with a special case for event listeners, where only listed events
379+
are propagated to their related listeners.
380+
381+
It will replace, in cache for generated service factories, the PHP autoload by
382+
plain inlined ``include_once``. The benefit is a complete bypass of the autoloader
383+
for services and their class hierarchy. The result is as significant performance improvement.
384+
385+
Use this tag with great caution, you have to be sure that the tagged service is always used.
386+
365387
controller.argument_value_resolver
366388
----------------------------------
367389

0 commit comments

Comments
 (0)