Skip to content

Conversation

@alexandre-daubois
Copy link
Member

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #59085
License MIT

Allow to repeat the AsTaggedItem attribute:

#[AsTaggedItem(index: 'multi_hello_1', priority: 1)]
#[AsTaggedItem(index: 'multi_hello_2', priority: 2)]
class MultiTagHelloNamedService
{
}

@carsonbot carsonbot added this to the 7.3 milestone Dec 4, 2024
@alexandre-daubois alexandre-daubois force-pushed the repeatable-as-tagged-item branch 2 times, most recently from 98b479c to 1d91ded Compare December 4, 2024 12:52
@alexandre-daubois alexandre-daubois force-pushed the repeatable-as-tagged-item branch from 1d91ded to 34e3466 Compare December 11, 2024 15:54
@alexandre-daubois alexandre-daubois changed the title [DependencyInjection] Make AsTaggedItem attribute repeatable Make #[AsTaggedItem] repeatable Dec 11, 2024
@alexandre-daubois alexandre-daubois changed the title Make #[AsTaggedItem] repeatable [DependencyInjection] Make #[AsTaggedItem] repeatable Dec 11, 2024
@fabpot
Copy link
Member

fabpot commented Jan 2, 2025

Thank you @alexandre-daubois.

@fabpot fabpot merged commit a993465 into symfony:7.3 Jan 2, 2025
4 of 11 checks passed
nicolas-grekas added a commit that referenced this pull request Jan 5, 2025
… container builder (xabbuh)

This PR was merged into the 7.3 branch.

Discussion
----------

[DependencyInjection] reuse the reflector tracked by the container builder

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

reworking the implementation from #59088 a bit

Commits
-------

b8b5fb4 reuse the reflector tracked by the container builder
@fabpot fabpot mentioned this pull request May 2, 2025
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Nov 5, 2025

I had a look at this code and the implementation doesn't make any sense sorry. This should be reverted, it's clumsy as it doesn't respect the flexibility provided by DI tags.
The proper way to solve the concern in #59085 is to add several userland tags on the class that needs to be repeated.

@stof
Copy link
Member

stof commented Nov 5, 2025

I agree with @nicolas-grekas. This implementation will read AsTaggedItem even when tag attributes are configured explicitly, which is not how this tag is meant to work.

@alexandre-daubois
Copy link
Member Author

I'm working on a fix, it should be ready soon.

nicolas-grekas added a commit that referenced this pull request Nov 12, 2025
…ggeditem] (nicolas-grekas)

This PR was merged into the 7.3 branch.

Discussion
----------

[DependencyInjection] Fix merging explicit tags and #[AsTaggeditem]

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #59088 (comment)
| License       | MIT

Instead of #62327

Commits
-------

e31b192 [DependencyInjection] Fix merging explicit tags and #[AsTaggeditem]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow #[AsTaggedItem] to be repeated

8 participants