Skip to content

[DependencyInjection] Bind tagged services #12741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
# optionally you can define both the name and type of the argument to match
string $adminEmail: 'manager@example.com'
Psr\Log\LoggerInterface $requestLogger: '@monolog.logger.request'
iterable $rules: !tagged_iterator app.foo.rule

# ...

Expand Down Expand Up @@ -695,6 +696,10 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
type="service"
id="monolog.logger.request"
/>
<bind key="iterable $rules"
type="tagged_iterator"
tag="app.foo.rule"
/>
</defaults>

<!-- ... -->
Expand Down Expand Up @@ -728,6 +733,7 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
// optionally you can define both the name and type of the argument to match
->bind('string $adminEmail', 'manager@example.com')
->bind(LoggerInterface::class.' $requestLogger', ref('monolog.logger.request'))
->bind('iterable $rules', tagged_iterator('app.foo.rule'))
;

// ...
Expand Down