8000 [DependencyInjection] Enable deprecating parameters · symfony/symfony-docs@3f6a0b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f6a0b6

Browse files
[DependencyInjection] Enable deprecating parameters
1 parent 740e44f commit 3f6a0b6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

service_container.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,23 @@ accessor methods for parameters::
607607
To learn more about compiling the container see
608608
:doc:`/components/dependency_injection/compilation`.
609609

610+
It is also possible to deprecate a container parameter. This is particularly useful
611+
if you're writing your own package and want to warn developers to not use a parameter anymore
612+
because it will be removed in one of the next version of your package.
613+
Deprecating a container parameter can be done as follow::
614+
615+
$container->deprecateParameter(
616+
'vendor.database_user',
617+
'vendor-name/package-name',
618+
'1.3',
619+
// optionally you can set a custom deprecation message
620+
'"vendor.database_user" is deprecated, you should configure database credentials in "vendor.database_dsn" parameter instead.'
621+
);
622+
623+
.. versionadded:: 6.3
624+
625+
The ``ContainerBuilder::deprecateParameter`` method was introduced in Symfony 6.3.
626+
610627
.. _services-wire-specific-service:
611628

612629
Choose a Specific Service

0 commit comments

Comments
 (0)
0