Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  -
  Add ENV processor example
  • Loading branch information
OskarStark committed Apr 17, 2024
2 parents 28cff68 + 51a8bb9 commit 1888152
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service_container/autowiring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,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 @@ -636,6 +637,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')]
bool $allowAttachments,
) {
}
// ...
Expand Down

0 comments on commit 1888152

Please sign in to comment.