diff --git a/controller/service.rst b/controller/service.rst index 6ee5faeaf0b..2ceb4594024 100644 --- a/controller/service.rst +++ b/controller/service.rst @@ -71,6 +71,38 @@ syntax: You cannot drop the ``Action`` part of the method name when using the single colon notation. +Embedding your controller in a template +--------------------------------------- + +If you want to :doc:`embed your controller in a template `, +you need to use the following syntax: + +.. configuration-block:: + + .. code-block:: html+twig + + {# app/Resources/views/base.html.twig #} + + {# ... #} + + + .. code-block:: html+php + + + + + + .. _controller-service-invoke: Invokable Controllers diff --git a/templating/embedding_controllers.rst b/templating/embedding_controllers.rst index 228ae4053ee..6fcb1bcf32a 100644 --- a/templating/embedding_controllers.rst +++ b/templating/embedding_controllers.rst @@ -98,4 +98,36 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): ) ?> +If your controller should be used :doc:`as a service `, +you can reference it like this instead: + +.. configuration-block:: + + .. code-block:: html+twig + + {# app/Resources/views/base.html.twig #} + + {# ... #} + + + .. code-block:: html+php + + + + + + + The result of an embedded controler can also be :doc:`cached `