Can’t make dump() work in Symfony 4.2 toolbar

I am new to Stack Overflow and programming and I have a bad english, so sorry in advance if I don’t ask things correctly.

I am learning how to use Symfony and I can’t get the dump() function to work properly. I followed the instruction at :
https://symfony.com/doc/current/components/var_dumper.html

I installed the VarDumper component and the Debug Bundle using composer :

composer require --dev symfony/debug-bundle
composer require --dev symfony/var-dumper

Then I used dump() in my app controller in order to show the HTTP request when I submit a form :

use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyComponentHttpFoundationRequest;

 class BlogController extends AbstractController
{
    /**
     * @Route("/blog/new", name="blog_create")
     */
    public function blog_create(Request $request): Response
    {
        dump($request);
        return $this->render('blog/create.html.twig',['request'=>$request]);
    }
}

The dump() should appear in the debug tool bar. Instead, when I call ‘blog/new’, I just have the normal display of the form page and my debug toolbar doesn’t show. However, I know that the VarDumper component works because I tried to use the dump server and the console shows me the result of the dump each time I call ‘blog/new’. I am able to find the content of my form in this dump.

Does someone have an idea on how to show the result of dump() inside the debug toolbar and without breaking it ?

Regards,

myst

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *