Skip to content

Commit a53627b

Browse files
committed
minor #19794 Add ENV processor example (antoniovj1)
This PR was merged into the 6.4 branch. Discussion ---------- Add ENV processor example Added example of autowiring with env processor Commits ------- face906 Add ENV processor example
2 parents e05c5b1 + face906 commit a53627b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

service_container/autowiring.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ logic about those arguments::
614614

615615
The ``#[Autowire]`` attribute can also be used for :ref:`parameters <service-parameters>`,
616616
:doc:`complex expressions </service_container/expression_language>` and even
617-
:ref:`environment variables <config-env-vars>`::
617+
:ref:`environment variables <config-env-vars>` ,
618+
:doc:`including env variable processors </configuration/env_var_processors>`::
618619

619620
// src/Service/MessageGenerator.php
620621
namespace App\Service;
@@ -640,6 +641,10 @@ The ``#[Autowire]`` attribute can also be used for :ref:`parameters <service-par
640641
// environment variables
641642
#[Autowire(env: 'SOME_ENV_VAR')]
642643
string $senderName,
644+
645+
// environment variables with processors
646+
#[Autowire(env: 'bool:SOME_BOOL_ENV_VAR')]
647+
string $allowAttachments,
643648
) {
644649
}
645650
// ...

0 commit comments

Comments
 (0)