From e1508276ad142742e89508ed6510985607e20614 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Wed, 7 Feb 2018 11:59:59 +0100 Subject: [PATCH 1/2] [Container][Tags] Added a note about _instanceof I was looking for this yesterday and couldn't find it, so I'm hereby updating the doc. This will also fix #9089. --- service_container/tags.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service_container/tags.rst b/service_container/tags.rst index c6cecfcd288..62a52c30b2a 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -81,6 +81,14 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you. ; } } + + If you do not want to create a custom kernel, it is also possible to use `_instanceof`: + + // app/config/services.yml + services: + _instanceof: + AppBundle\Component\CustomInterface: + tags: ['app.custom_tag'] Creating custom Tags -------------------- From c789f9899b23fa25e88ea0bbda2a383c3ac9141f Mon Sep 17 00:00:00 2001 From: Mitchell Date: Wed, 7 Feb 2018 12:30:47 +0100 Subject: [PATCH 2/2] Added explicit codeblocks --- service_container/tags.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service_container/tags.rst b/service_container/tags.rst index 62a52c30b2a..ffac1487a77 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -69,6 +69,8 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you. interface, call the :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerForAutoconfiguration` method in an :doc:`extension ` or from your kernel:: + .. code-block:: php + // app/AppKernel.php class AppKernel extends Kernel { @@ -81,9 +83,11 @@ that it implements ``Twig_ExtensionInterface``) and adds the tag for you. ; } } - + If you do not want to create a custom kernel, it is also possible to use `_instanceof`: + .. code-block:: yaml + // app/config/services.yml services: _instanceof: