@@ -363,19 +363,18 @@ If you register this as a service, you now have *two* services that implement th
363
363
which one to use. Remember, autowiring isn't magic; it looks for a service
364
364
whose id matches the type-hint. So you need to choose one by creating an alias
365
365
from the type to the correct service id (see :ref: `autowiring-interface-alias `).
366
- Additionally, you can define several named aliases if you want to use
366
+ Additionally, you can define several named autowiring aliases if you want to use
367
367
one implementation in some cases, and another implementation in some
368
368
other cases.
369
369
370
-
371
370
For instance, you may want to use by default the ``Rot13Transformer ``
372
371
implementation by default when the ``TransformerInterface `` interface is
373
372
type hinted, but use the ``UppercaseTransformer `` implementation in some
374
373
specific cases. To do so, you can create a normal alias from the
375
374
``TransformerInterface `` interface to ``Rot13Transformer ``, and then
376
- create a *named alias * from a special string containing the interface
377
- followed by a variable name matching the one you use when doing the
378
- injection::
375
+ create a *named autowiring alias * from a special string containing the
376
+ interface followed by a variable name matching the one you use when doing
377
+ the injection::
379
378
380
379
namespace App\Service;
381
380
@@ -423,9 +422,8 @@ injection::
423
422
# the Rot13Transformer will be passed as the $transformer argument
424
423
autowire : true
425
424
426
- # If you wanted to choose the non-default service and
427
- # do not want to use a named alias, wire it manually
428
- # arguments:
425
+ # If you wanted to choose the non-default service and do not
426
+ # want to use a named autowiring alias, wire it manually:
429
427
# $transformer: '@App\Util\UppercaseTransformer'
430
428
# ...
431
429
@@ -484,7 +482,7 @@ under the arguments key.
484
482
485
483
.. versionadded :: 4.2
486
484
487
- Named aliases have been introduced in Symfony 4.2.
485
+ Named autowiring aliases have been introduced in Symfony 4.2.
488
486
489
487
Fixing Non-Autowireable Arguments
490
488
---------------------------------
0 commit comments