File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -1487,12 +1487,33 @@ in a JavaScript string, use the ``js`` context:
14871487Debugging
14881488---------
14891489
1490- When using PHP, you can use :phpfunction: ` var_dump ` if you need to quickly find
1491- the value of a variable passed. This is useful, for example, inside your
1492- controller. The same can be achieved when using Twig thanks to the debug
1493- extension.
1490+ When using PHP, you can use the
1491+ :ref: ` dump() function from the VarDumper component < components-var-dumper-dump >`
1492+ if you need to quickly find the value of a variable passed. This is useful,
1493+ for example, inside your controller::
14941494
1495- Template parameters can then be dumped using the ``dump `` function:
1495+ // src/AppBundle/Controller/ArticleController.php
1496+ namespace AppBundle\Controller;
1497+
1498+ // ...
1499+
1500+ class ArticleController extends Controller
1501+ {
1502+ public function recentListAction()
1503+ {
1504+ $articles = ...;
1505+ dump($articles);
1506+
1507+ // ...
1508+ }
1509+ }
1510+
1511+ .. note ::
1512+
1513+ The output of the ``dump() `` function is then rendered in the web developer
1514+ toolbar.
1515+
1516+ The same mechanism can be used in Twig templates thanks to ``dump `` function:
14961517
14971518.. code-block :: html+jinja
14981519
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ You can install the component in 2 different ways:
2020* :doc: `Install it via Composer </components/using_components >` (``symfony/var-dumper `` on `Packagist `_);
2121* Use the official Git repository (https://github.com/symfony/var-dumper).
2222
23+ .. _components-var-dumper-dump :
24+
2325The dump() Function
2426-------------------
2527
You can’t perform that action at this time.
0 commit comments