8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0bb8fe2 commit 3d9dfe6Copy full SHA for 3d9dfe6
service_container/remove.rst
@@ -0,0 +1,23 @@
1
+How to Remove a Service
2
+=======================
3
+
4
+A service can be removed from the service container if needed
5
+(for instance in the test or a specific environment):
6
7
+.. configuration-block::
8
9
+ .. code-block:: php
10
11
+ // config/services_test.php
12
+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13
14
+ use App\RemovedService;
15
16
+ return function(ContainerConfigurator $containerConfigurator) {
17
+ $services = $containerConfigurator->services();
18
19
+ $services->remove(RemovedService::class);
20
+ };
21
22
+Now, the container will not contain the ``App\RemovedService``
23
+in the test environment.
0 commit comments