Skip to content

Commit a423d8c

Browse files
committed
add an alias for the profiler service
1 parent 015703b commit a423d8c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

profiler/matchers.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,35 @@ class in your controllers to manage the profiler programmatically::
2929
// ...
3030
}
3131
}
32+
33+
In order for the profiler to be injected into your controller you need to
34+
create an alias pointing to the existing ``profiler`` service:
35+
36+
.. configuration-block::
37+
38+
.. code-block:: yaml
39+
40+
# config/services.yaml
41+
services:
42+
Symfony\Component\HttpKernel\Profiler\Profiler: '@profiler'
43+
44+
.. code-block:: xml
45+
46+
<!-- config/services.xml -->
47+
<?xml version="1.0" encoding="UTF-8" ?>
48+
<container xmlns="http://symfony.com/schema/dic/services"
49+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
50+
xsi:schemaLocation="http://symfony.com/schema/dic/services
51+
http://symfony.com/schema/dic/services/services-1.0.xsd">
52+
53+
<services>
54+
<service id="Symfony\Component\HttpKernel\Profiler\Profiler" alias="profiler" />
55+
</services>
56+
</container>
57+
58+
.. code-block:: php
59+
60+
// config/services.php
61+
use Symfony\Component\HttpKernel\Profiler\Profiler;
62+
63+
$container->setAlias(Profiler::class, 'profiler');

0 commit comments

Comments
 (0)