tags:

views:

46

answers:

2

Hi folk!

I am using Doctrine and sometimes I've the feeling that it is doing much more things than what I am expecting, so I would like to have more information (and therefore more control) about what Doctrine is doing.

So, how I could count the total number of queries that Doctrine is doing?. It would be nice if I could also find the SQL statements that Doctrine is performing implicitly, (apart of the ones that I am creating).

Thank you in advance!

+1  A: 

I suggest this wonderful article:

http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-8-hooks-profiling-dql

Find the section that's headed "Profiling with Doctrine" This is specific for the use with a framework but you should figure out how to do it without the framework, it's not hard

DrColossos
That's cool! Even more because actually I am using Doctrine with CodeIgniter :).Thanks!
javi
+2  A: 

Doctrine has a Profiler components, that allows one to keep track of every access that's done to the database.

See : Profiler


Note, though, that the profiler could get you much more informations that you expect : depending on how you configure it, it'll indicate each time some data is fetched from the DB as an event (even if it doesn't mean a query is performed each time).

Also; as Doctrine is using prepared statements, you'll never be able to see any "real" SQL query : you'll only see statements, and the corresponding data.

Pascal MARTIN