symfonysymfony4orocrmorocommerce

Can't use Symfony VarDumper - Attempted to call function "dump" from namespace


Context

I'm currently working on an OroPlatform project (4.1.10) and I can't use the Symfony dump function in my controllers.

enter image description here

Issue

I've seen on Packagist that OroPlatform 4.1.10 has the symfony/symfony dependency which contains symfony/var-dumper: v4.4.13 and when I've tried to install it, I've got the following error message : Package symfony/var-dumper is not installed


Solution

  • To register the dump function, you have to edit src\AppKernel::registerBundles() method to add there

    $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
    

    inside if ('dev' === $this->getEnvironment()) { statement