Email iconarrow-down-circleGroup 8Path 3arrow-rightGroup 4Combined Shapearrow-rightGroup 4Combined ShapeUntitled 2Untitled 2Path 3ozFill 166crosscupcake-icondribbble iconGroupPage 1GitHamburgerPage 1Page 1LinkedInOval 1Page 1Email iconphone iconPodcast ctaPodcast ctaPodcastpushpinblog icon copy 2 + Bitmap Copy 2Fill 1medal copy 3Group 7twitter icontwitter iconPage 1

We have been working on a few projects using Doctrine 2 and Zend Framework (ZF). We are using the Bisna Package (some additional documentation available here) as the glue to get everything working together nicely.

When working with any application it is always useful to have some kind of reporting mechanism for execution time, number of queries, memory use etc and we have used the following to help us profile our applications.

Doctrine 2 provides a simple interface for logging, namely
and the following resources implement it.

Using ZFDebug and the Doctrine 2 plugin

Download and unpack the ZFDebug package from

Drop the ZFDebug folder found in the ‘library’ directory of the unzipped package next to your Zend folder in the library directory of your application.

The ZFDebug plugin includes the following code for bootstrapping the ZFDebug bar with Doctrine 2

As our Doctrine 2 configuration is set in the application.ini we are using the following code

You can also install and enable the python-sqlparse on your development environment to prettify the SQL output, however this will increase your script execution time for each application, I noticed an increase of ~1 second locally.

Using FirePHP to profile Doctrine 2

Micheal Ridgway’s package is also very easy to get up and running. First make sure you have Firefox, Firebug and FirePHP installed.

Then download and extract the above package from github.

Grab the ZendX directory found inside lib in the package, and drop it into your application’s library directory (next to your Zend folder as with ZFDebug).

You can then load the plugin with the following code

Then load up your app in firefox and check out the console in Firebug for query logging goodness.

N.B. There appears to be a FirePHP extension for Chrome, but I couldn’t get it working, so I would recommend using ZFDebug if Chrome is your browser of choice.

There is also a plugin for Doctrine 1 and ZFDebug