Skip to content

Conversation

IonBazan
Copy link

@IonBazan IonBazan commented Sep 15, 2021

Documents symfony/symfony#43015

This is my first docs contribution so please let me know if it's correct.

nicolas-grekas added a commit to symfony/symfony that referenced this pull request Sep 17, 2021
…as service locator arguments (IonBazan) This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Allow injecting tagged iterator as service locator arguments | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | symfony/symfony-docs#15821 Not sure if this is a feature or bug fix - kindly update the description and target branch and I will backport the changes for older version if needed. This feature allows creating a named (reusable) service locator using tagged services: ```yml services: _instanceof: App\Command\HandlerInterface: tags: ['app.command_handler'] app.command_handlers: class: Symfony\Component\DependencyInjection\ServiceLocator arguments: [!tagged_iterator { tag: 'app.command_handler', default_index_method: 'getCommandName' }] App\CommandBus: arguments: ['`@app`.command_handlers'] App\AnotherCommandBus: arguments: ['`@app`.command_handlers'] ``` Prior to this change, following error would be thrown: ``` Invalid definition for service "app.command_handlers": an array of references is expected as first argument when the "container.service_locator" tag is set. ``` Commits ------- 7c86ac8 Allow injecting tagged iterator as service locator arguments
@OskarStark OskarStark added this to the 5.4 milestone Nov 24, 2021
@xabbuh xabbuh modified the milestones: 5.4, 6.4 Dec 16, 2024
@OskarStark
Copy link
Contributor

Thank you @IonBazan for your contribution! We're closing this PR due to lack of recent activity. If this documentation is still needed, please feel free to open a new PR against the current version of the docs.

@OskarStark OskarStark closed this Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment