How to Show Current Query When Using Activerecord in Yii2

By | April 24, 2019

Today just a simple command. If you need to know the current query for an Activerecord object, you need this simple command:

$query->createCommand()->getRawSql();

This will show current SQL query. Another solution is:

$query->createCommand()->sql;

Leave a Reply

Your email address will not be published. Required fields are marked *