Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fff23f7

Browse filesBrowse files
pamuchewouterj
authored andcommitted
Note to create a service if you extend ExceptionController
1 parent d2c3e26 commit fff23f7
Copy full SHA for fff23f7

File tree

Expand file treeCollapse file tree

1 file changed

+19
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-1
lines changed

‎cookbook/controller/error_pages.rst

Copy file name to clipboardExpand all lines: cookbook/controller/error_pages.rst
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,25 @@ will be passed two parameters:
217217
Instead of creating a new exception controller from scratch you can, of course,
218218
also extend the default :class:`Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController`.
219219
In that case, you might want to override one or both of the ``showAction()`` and
220-
``findTemplate()`` methods. The latter one locates the template to be used.
220+
``findTemplate()`` methods. The latter one locates the template to be used.
221+
222+
.. note::
223+
224+
In case of extending the :class:`Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController`
225+
you may configure a service to pass the Twig environment and the ``debug`` flag to the constructor.
226+
227+
.. configuration-block::
228+
229+
.. code-block:: yaml
230+
231+
# app/config/config.yml
232+
services:
233+
app.extension_controller:
234+
class: AppBundle\CustomExceptionController
235+
arguments: [ "@twig", "%kernel.debug%" ]
236+
237+
twig:
238+
exception_controller: app.extension_controller:showAction
221239
222240
.. _use-kernel-exception-event:
223241

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.