symfony-docs icon indicating copy to clipboard operation
symfony-docs copied to clipboard

[DependencyInjection] Improve documentation about differences between `AutowireIterator` and `AutowireLocator`

Open etshy opened this issue 1 year ago • 0 comments

The doc about these Attributes states

To receive an iterable instead of a service locator, you can switch the AutowireLocator attribute to AutowireIterator attribute.

Though these two Attributes are not "switchable" as-is because AutowireLocator can accept a string (tag) or an array of class (classname or SubscribedService) while AutowireIterator can only accept a string (tag).

If it's intended maybe, the doc should make the difference clear, especially because there is no example of usage of AutowireIterator. It it's not intended, then the problem lies in DependencyInjection code and AutowireIterator should be able to accept an array of class too.

etshy avatar Sep 26 '24 14:09 etshy