Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion service_container/autowiring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@ logic about those arguments::

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

// src/Service/MessageGenerator.php
namespace App\Service;
Expand All @@ -640,6 +641,10 @@ The ``#[Autowire]`` attribute can also be used for :ref:`parameters <service-par
// environment variables
#[Autowire(env: 'SOME_ENV_VAR')]
string $senderName,

// environment variables with processors
#[Autowire(env: 'bool:SOME_BOOL_ENV_VAR')]
string $allowAttachments,
) {
}
// ...
Expand Down