Skip to content

Commit 90365f6

Browse files
committed
Remove the TwigBundle\ExceptionController mention and extending doc
1 parent ec9e093 commit 90365f6

File tree

1 file changed

+4
-62
lines changed

1 file changed

+4
-62
lines changed

controller/error_pages.rst

+4-62
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ configuration option to point to it:
253253
254254
# config/packages/framework.yaml
255255
framework:
256-
error_controller: App\Controller\ErrorController::showAction
256+
error_controller: App\Controller\ErrorController::show
257257
258258
.. code-block:: xml
259259
@@ -265,7 +265,7 @@ configuration option to point to it:
265265
https://symfony.com/schema/dic/services/services-1.0.xsd">
266266
267267
<framework:config>
268-
<framework:error-controller>App\Controller\ErrorController::showAction</framework:error-controller>
268+
<framework:error-controller>App\Controller\ErrorController::show</framework:error-controller>
269269
</framework:config>
270270
271271
</container>
@@ -274,7 +274,7 @@ configuration option to point to it:
274274
275275
// config/packages/framework.php
276276
$container->loadFromExtension('framework', [
277-
'error_controller' => 'App\Controller\ErrorController::showAction',
277+
'error_controller' => 'App\Controller\ErrorController::show',
278278
// ...
279279
]);
280280
@@ -284,70 +284,12 @@ the request that will be dispatched to your controller. In addition, your contro
284284
will be passed two parameters:
285285

286286
``exception``
287-
A :class:`\\Symfony\\Component\\ErrorHandler\\Exception\\FlattenException`
288-
instance created from the exception being handled.
287+
The original :class:`Throwable` instance exception being handled.
289288

290289
``logger``
291290
A :class:`\\Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface`
292291
instance which may be ``null`` in some circumstances.
293292

294-
Instead of creating a new exception controller from scratch you can also extend
295-
the default :class:`Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController`.
296-
In that case, you might want to override one or both of the ``showAction()`` and
297-
``findTemplate()`` methods. The latter one locates the template to be used.
298-
299-
.. note::
300-
301-
In case of extending the
302-
:class:`Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController` you
303-
may configure a service to pass the Twig environment and the ``debug`` flag
304-
to the constructor.
305-
306-
.. configuration-block::
307-
308-
.. code-block:: yaml
309-
310-
# config/services.yaml
311-
services:
312-
_defaults:
313-
# ... be sure autowiring is enabled
314-
autowire: true
315-
# ...
316-
317-
App\Controller\CustomExceptionController:
318-
public: true
319-
arguments:
320-
$debug: '%kernel.debug%'
321-
322-
.. code-block:: xml
323-
324-
<!-- config/services.xml -->
325-
<?xml version="1.0" encoding="UTF-8" ?>
326-
<container xmlns="http://symfony.com/schema/dic/services"
327-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
328-
xsi:schemaLocation="http://symfony.com/schema/dic/services
329-
https://symfony.com/schema/dic/services/services-1.0.xsd">
330-
331-
<services>
332-
<!-- ... be sure autowiring is enabled -->
333-
<defaults autowire="true"/>
334-
<!-- ... -->
335-
336-
<service id="App\Controller\CustomExceptionController" public="true">
337-
<argument key="$debug">%kernel.debug%</argument>
338-
</service>
339-
</services>
340-
341-
</container>
342-
343-
.. code-block:: php
344-
345-
// config/services.php
346-
use App\Controller\CustomExceptionController;
347-
348-
$container->autowire(CustomExceptionController::class)
349-
->setArgument('$debug', '%kernel.debug%');
350-
351293
.. tip::
352294

353295
The :ref:`error page preview <testing-error-pages>` also works for

0 commit comments

Comments
 (0)