How to clean dump Doctrine2 entity (entities) without print_r and crash Apache

Have you ever try print_r($entity)? Apache crash? Yes – exactly. Doctrine2 entity has massive recursion and trying dump by print_r give Apache crash. How to do this safely  and clean?

echo '<pre>';
\Doctrine\Common\Util\Debug::dump($entity);
echo '</pre>';

Have a productive day 🙂

Leave a Comment: