I have a portal made with Symfony 3.4 and Sonata Admin.
In a specific admin page there are a lot of generated queries. I used the profiler to track them down but I cannot see where they generated from:
There is the same query repeated a lot of times with different IDs:
Is there a way to understand where they are generated? I saw that post and it seems impossible to do at the moment:
https://github.com/doctrine/DoctrineBundle/issues/722
Can't I just drop a dump/die
somewhere in the profiler to get the specific line?
Since v1.11.0, Doctrine Bundle can display query backtrace in Symfony Profiler. This is may be helpful to find what code caused the specific query to be executed.
The feature is disabled by default but you can enable it using profiling_collect_backtrace
configuration in your doctrine connection settings.
See https://symfony.com/blog/new-in-doctrinebundle-1-11-0#store-backtraces-when-profiling-queries for more information.
I just found this plugin which is doing exactly what I need:
https://github.com/VincentChalnot/DoctrineDebugBundle
It seems to work fine and it's showing the stack trace from the query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With