Too much data with var_dump in symfony2 doctrine2

Mirage picture Mirage · Aug 10, 2012 · Viewed 82k times · Source

I have around 40 entities and many bidirectional relationships. Whenever i use var_dump($user) or any entity my browser gets loaded with too much data of arrays and variables then it just crashed.

i want to whats the problem.

The data is being inserted fine. Can i cause issue in production.

Answer

mgiagnoni picture mgiagnoni · Aug 11, 2012

Replace var_dump() with the debug method dump() provided by Doctrine Common.

\Doctrine\Common\Util\Debug::dump($user);

It works for single objects and Doctrine collections and should prevent browser displaying issues you are having.