File tree 2 files changed +8
-8
lines changed
Filter options
2 files changed +8
-8
lines changed
Original file line number Diff line number Diff line change @@ -225,8 +225,8 @@ command:
225
225
226
226
.. tip ::
227
227
228
- If you need control over the *exact * value of an argument, you can use the
229
- ``#[Autowire] `` attribute::
228
+ If you need control over the *exact * value of an argument, or require a parameter,
229
+ you can use the ``#[Autowire] `` attribute::
230
230
231
231
// ...
232
232
use Psr\Log\LoggerInterface;
@@ -239,7 +239,7 @@ command:
239
239
int $max,
240
240
241
241
// inject a specific logger service
242
- #[Autowire('@ monolog.logger.request')]
242
+ #[Autowire(service: ' monolog.logger.request')]
243
243
LoggerInterface $logger,
244
244
245
245
// or inject parameter values
Original file line number Diff line number Diff line change @@ -545,8 +545,8 @@ To fix this, you can :ref:`manually wire the problematic argument <services-manu
545
545
in the service configuration. You wire up only the difficult arguments,
546
546
Symfony takes care of the rest.
547
547
548
- You can also use the ``#[Autowire] `` parameter attribute to configure the
549
- problematic arguments:
548
+ You can also use the ``#[Autowire] `` parameter attribute to instruct the autowiring
549
+ logic about those arguments:
550
550
551
551
// src/Service/MessageGenerator.php
552
552
namespace App\S ervice;
@@ -557,7 +557,7 @@ problematic arguments:
557
557
class MessageGenerator
558
558
{
559
559
public function __construct(
560
- #[Autowire('@ monolog.logger.request')] LoggerInterface $logger
560
+ #[Autowire(service: ' monolog.logger.request')] LoggerInterface $logger
561
561
) {
562
562
// ...
563
563
}
@@ -586,8 +586,8 @@ and even :doc:`complex expressions </service_container/expression_language>`::
586
586
#[Autowire('%kernel.debug%')]
587
587
bool $debugMode,
588
588
589
- // and @=... for expressions
590
- #[Autowire("@= service("App\\Mail\\MailerConfiguration").getMailerMethod()")]
589
+ // and expressions
590
+ #[Autowire(expression: " service("App\\Mail\\MailerConfiguration").getMailerMethod()")]
591
591
string $mailerMethod
592
592
) {
593
593
}
You can’t perform that action at this time.
0 commit comments