-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected: 4.3.11
Description
Reference Tagged Services combined with Autoconfiguring Tags does not work
How to reproduce
- Create interface
- Tag the interface under
_instanceof- as described in Autoconfiguring Tags - Create a service and pass all
!taggedservices as its arguments - as described in Reference Tagged Services - Run
bin/console cache:clear(or any other command) - You will see
Cannot autowire service (…): argument "$handlers" of method "__construct()" is type-hinted "iterable", you should configure its value explicitly.exception
Is it a bug?
Workaround
- Create a Compiler Pass class that implements
CompilerPassInterface - Call
findTaggedServiceIds()+addMethodCall()as described in How to Work with Compiler Passes
Is there another solution?