This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony
Nicolas Grekas 1e6237c717 feature #40248 [DependencyInjection] Add #[TaggedItem] attribute for defining the index and priority of classes found in tagged iterators/locators (nicolas-grekas)
This PR was merged into the 5.3-dev branch.

Discussion
----------

[DependencyInjection] Add `#[TaggedItem]` attribute for defining the index and priority of classes found in tagged iterators/locators

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Next to #39804, this PR adds a new `#[TaggedItem]` attribute that ppl can use to define the index of their service classes when they're used in tagged collections (iterators/locators.

This replaces the `public static getDefaultName()` and `getDefaultPriority()` methods that ppl could use for this purpose:
```php
#[TaggedItem(index: 'api.logger', priority: 123)]
class MyApiLogger implements LoggerInterface
{
}
```

This will ship the corresponding service at index `api.logger`, priority=123 when building locators/iterators.

Commits
-------

252f2ca1fb [DependencyInjection] Add `#[TaggedItem]` attribute for defining the index and priority of classes found in tagged iterators/locators
2021-03-16 09:24:13 +01:00
..
Bridge feature #40448 [twig-bridge] Allow NotificationEmail to be marked as public (maxailloud) 2021-03-12 07:00:29 +01:00
Bundle bug #40373 Check if templating engine supports given view (fritzmg) 2021-03-12 09:20:53 +01:00
Component feature #40248 [DependencyInjection] Add #[TaggedItem] attribute for defining the index and priority of classes found in tagged iterators/locators (nicolas-grekas) 2021-03-16 09:24:13 +01:00
Contracts [DependencyInjection] Implement psr/container 1.1 2021-03-05 23:51:52 +01:00