Generated SQL from ActiveQuery


at one point I build an complex ActiveQuery, and as it is not working as expexted, I would like to output the generated SQL.

But, how can I do this? I don’t want to log all queries, I just want something like this:

echo $query->sql 



Enable log:

try this one:


->where(['account_id' => $params['account_id']])


the result will be: (w/o echo)