File tree 2 files changed +28
-5
lines changed
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:
1487
1487
Debugging
1488
1488
---------
1489
1489
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::
1494
1494
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:
1496
1517
1497
1518
.. code-block :: html+jinja
1498
1519
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ You can install the component in 2 different ways:
20
20
* :doc: `Install it via Composer </components/using_components >` (``symfony/var-dumper `` on `Packagist `_);
21
21
* Use the official Git repository (https://github.com/symfony/var-dumper).
22
22
23
+ .. _components-var-dumper-dump :
24
+
23
25
The dump() Function
24
26
-------------------
25
27
You can’t perform that action at this time.
0 commit comments