views:

276

answers:

1

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.

A: 

There is a third party Plugin and Library for Zend Framework that helped me with this issue. The library is called ZFDebug and there is too a Doctrine adapter (wich doesn't come in the ZFDebug library by default). Full instructions are inside the ZFDebug package. The Doctrine plugin displays all the events, the queries and the measured time spent in Database stuffs.

David Zapata