Skip to content

Commit 3df64f7

Browse files
authored
fix(documentation): reorder service id on target attribute
When I use the name with suffix `.lock.factory`, the service was not found. After a `debug:container LockFatory`, I see the service ID is `lock.xxx.factory`. `xxx` being the named service wanted.
1 parent a682bbd commit 3df64f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lock.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ For example, to inject the ``invoice`` package defined earlier::
308308

309309
When :ref:`dealing with multiple implementations of the same type <autowiring-multiple-implementations-same-type>`
310310
the ``#[Target]`` attribute helps you select which one to inject. Symfony creates
311-
a target called "asset package name" + ``.lock.factory`` suffix.
311+
a target called ``lock.`` + "asset package name" + ``.factory``.
312312

313313
For example, to select the ``invoice`` lock defined earlier::
314314

@@ -318,7 +318,7 @@ For example, to select the ``invoice`` lock defined earlier::
318318
class SomeService
319319
{
320320
public function __construct(
321-
#[Target('invoice.lock.factory')] private LockFactory $lockFactory
321+
#[Target('lock.invoice.factory')] private LockFactory $lockFactory
322322
): void {
323323
// ...
324324
}

0 commit comments

Comments
 (0)