File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -1487,12 +1487,28 @@ 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
+ .. code-block :: php
1496
+
1497
+ // src/AppBundle/Controller/ArticleController.php
1498
+ namespace AppBundle\Controller;
1499
+
1500
+ // ...
1501
+
1502
+ class ArticleController extends Controller
1503
+ {
1504
+ public function recentListAction()
1505
+ {
1506
+ $articles = ...;
1507
+ dump(articles);
1508
+ }
1509
+ }
1510
+
1511
+ The same mechanism can be used in Twig templates thanks to ``dump `` function:
1496
1512
1497
1513
.. code-block :: html+jinja
1498
1514
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