How to profile Doctrine in Zend Framework
- by David Zapata
Good day.
I'm using Doctrine as ORM for my Zend Framework project. This is the first time I use it. I've followed the ZendCasts Doctrine chapters, and everything works for me, but I needed to perform some profiling;
There is a Doctrine_Connection_Profiler class that should be used to profile the Doctrine Model internal queries, but I've tried to use it without success. I always get a "PDOException: You cannot serialize or unserialize PDOStatement instances" exception when I perform my Unit Tests.
Here is a example:
$conn = Doctrine_Manager::connection($doctrineConfig['dsn'], $dbconfname);
...
if( APPLICATION_ENV != 'production'){
$obj_doctrine_profiler = new Doctrine_Connection_Profiler();
$conn->setListener($obj_doctrine_profiler);
}
All of my Unit Tests works if I comment/delete the
$conn->setListener($obj_doctrine_profiler);
line. This code block is located in my Bootstrap.php class; the weird thing is, the web application works just fine even with the mentioned code line.
Thank you so much for your help.
please excuse me if my english is not the best.