Skip to content

Commit 709e964

Browse files
committed
refer to the VarDumper component for dump()
1 parent eb48e4d commit 709e964

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

book/templating.rst

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,12 +1487,28 @@ in a JavaScript string, use the ``js`` context:
14871487
Debugging
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+
.. 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:
14961512

14971513
.. code-block:: html+jinja
14981514

components/var_dumper/introduction.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
2325
The dump() Function
2426
-------------------
2527

0 commit comments

Comments
 (0)