With my symfony2/doctrine2 application, there are cases when I have a hard time figurint out where I did not addselect the right entities in my queries, which results in abnormal number of queries.
I am looking forward to build a class that would return the trace for each query I've launched, so I can understand where I need to addselect what.
Questions:
postLoad
event of doctrien the right one to do that ? I did
not found a select eventEDIT :
I managed to modify the profiler. See how it's done here :
Symfony2 / Doctrine2 : How to override DebugStack class used in doctrine DataCollector?
If you are talking about SELECT
queries than probably the postLoad
event is enough.
You can always use debug_backtrace
to generate the trace without any exceptions.
http://php.net/manual/en/function.debug-backtrace.php
Then you can log it for further processing.