Skip to content

Commit 634b284

Browse files
committed
feature #12741 [DependencyInjection] Bind tagged services (tienvx)
This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] Bind tagged services Update documentation for https://symfony.com/blog/new-in-symfony-4-4-dependency-injection-improvements-part-1#allow-binding-tagged-services NOTE: this documentation require symfony/symfony#34732 to be merged Commits ------- 7ec6d9d [DependencyInjection] Bind tagged services
2 parents 230fb24 + 7ec6d9d commit 634b284

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

service_container.rst

+6
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
665665
# optionally you can define both the name and type of the argument to match
666666
string $adminEmail: 'manager@example.com'
667667
Psr\Log\LoggerInterface $requestLogger: '@monolog.logger.request'
668+
iterable $rules: !tagged_iterator app.foo.rule
668669
669670
# ...
670671
@@ -695,6 +696,10 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
695696
type="service"
696697
id="monolog.logger.request"
697698
/>
699+
<bind key="iterable $rules"
700+
type="tagged_iterator"
701+
tag="app.foo.rule"
702+
/>
698703
</defaults>
699704
700705
<!-- ... -->
@@ -728,6 +733,7 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type
728733
// optionally you can define both the name and type of the argument to match
729734
->bind('string $adminEmail', 'manager@example.com')
730735
->bind(LoggerInterface::class.' $requestLogger', ref('monolog.logger.request'))
736+
->bind('iterable $rules', tagged_iterator('app.foo.rule'))
731737
;
732738
733739
// ...

0 commit comments

Comments
 (0)