Jonas de Herdt Jonas de Herdt - 10 months ago 39
PHP Question

Is there a way to dump 'self', or the container object in a symfony twig template?

I have a twig template that extends from a sonata_block.
But I cant find any variables to dump.

Is there a way to dump the wrapper element, or container?
eg: {{ dump(this)}}, or {{ dump(self)}}


You can list all available variables in twig templates by looping through the _context var :

{% for key, value in _context  %}
    <h2>{{ key }}</h2>
    {{ dump(value) }}
{% endfor %}