When using Doctrine, it is sometimes important to find where an SQL query is executed.
Just turn on profiling_collect_backtrace on the connection, in the development configuration (config/packages/dev/doctrine.yaml):
doctrine:
dbal:
connections:
default:
profiling_collect_backtrace: trueKeep it for development only: collecting the call stack on every query is expensive. It relies on profiling, which is on by default when %kernel.debug% is true. The full list of options is in the Doctrine configuration.
The stack trace then shows up in the profiler, Doctrine tab, when you expand a query.

