Answer the question
In order to leave comments, you need to log in
Where in the doc is the service tagging behavior described?
It doesn't work in my bundle.
# config/services.yaml
services:
# this config only applies to the services created by this file
_instanceof:
# services whose classes are instances of CustomInterface will be tagged automatically
App\Security\CustomInterface:
tags: ['app.custom_tag']
#[Autoconfigure(tags: ['app.some_tag'])]
interface SomeInterface
{
// ...
}
Therefor if the service you are attempting to tag with _instanceof is not declared in the same services.yml file the tag will not be added. To tag services that implements an Interface in the entire application ...
Answer the question
In order to leave comments, you need to log in
https://symfony.com/doc/current/bundles/best_pract...
Services should not use autowiring or autoconfiguration. Instead, all services should be defined explicitly.
The reason is that bundles shouldn't rely on features such as service autowiring or autoconfiguration to not impose an overhead when compiling application services.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question