Reputation: 4565
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!
Upvotes: 1
Views: 1496
Reputation: 400932
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.
Upvotes: 2
Reputation: 12988
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
Upvotes: 2