grabbee
@grabbee

Где в доке описано поведение тэггирования сервисов?

У меня в бандле такое не работает

# 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']


Новое из 5,3 тоже не работает
#[Autoconfigure(tags: ['app.some_tag'])]
interface SomeInterface
{
    // ...
}


Нашел только в ответа на SO

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 ...


И в моем случае работает только registerForAutoconfiguration в расширении бандла. Почему так, и где это описано в доке я найти не смог.
  • Вопрос задан
  • 88 просмотров
Решения вопроса 1
BoShurik
@BoShurik Куратор тега Symfony
Symfony developer
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.


То что вы описали - как раз autoconfiguration
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы