Skip to content

Commit c89f73f

Browse files
Plopixjaviereguiluz
authored andcommitted
Autowiring - Rephrase aliasing when multiple classes implement same interface
1 parent 63795fa commit c89f73f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

service_container/autowiring.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,11 @@ Suppose you create a second class - ``UppercaseTransformer`` that implements
365365
}
366366

367367
If you register this as a service, you now have *two* services that implement the
368-
``AppBundle\Util\TransformerInterface`` type. Symfony doesn't know which one should
369-
be used for autowiring, so you need to choose one by creating an alias from the type
370-
to the correct service id (see :ref:`autowiring-interface-alias`).
368+
``AppBundle\Util\TransformerInterface`` type. Autowiring subsystem can not decide which
369+
one to use. Remember, Autowiring isn't magic: it simply
370+
looks for a service whose id matches the type-hint. So you need to choose one by
371+
creating an alias from the type to the correct service id
372+
(see :ref:`autowiring-interface-alias`).
371373

372374
If you want ``Rot13Transformer`` to be the service that's used for autowiring, create
373375
that alias:

0 commit comments

Comments
 (0)