I need to see raw SQL in many scenarios. It recently became known to me that the query composer can turn a query builder object into raw SQL.
You can then print the SQL statement to the log:
PHP Code:
$selectQuery = $entityManager->getQueryBuilder()
->select(['column1', 'column2', 'someExpression'])
->from('SomeTable')
->order('column1', 'DESC')
->limit(0, 10)
->build();
$sql = $entityManager->getQueryComposer()->compose($selectQuery);
You can then print the SQL statement to the log:
PHP Code:
$GLOBALS["log"]->debug("sql",[$sql]);