Twig dump isn't printing anything Twig dump isn't printing anything symfony symfony

Twig dump isn't printing anything


In Symfony 2.6, there is a new VarDumper component and DebugBundle. These override twig's dump() function to give a lot more and nicer dump output.

However, you have to register the DebugBundle in your AppKernel, otherwise it'll just ignore the call. To do this, you should add this to app/AppKernel.php:

// app/AppKernel.php// ...public function registerBundles(){    // ...    if (in_array($this->getEnvironment(), array('dev', 'test'))) {        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();        // ...    }    return $bundles;}

Please note that this new dump function will dump the output in the web dev toolbar, to avoid screwing up the page layout.

In 2.6.0, this will be fixed by having a fallback to the native twig dump() function why the DebugBundle is not registered.