Dump the Sql for a Query

Here’s a quick tip to dump the SQL for query.

 

    $query = new Books::find()->where('author=2');
    echo $query->createCommand()->sql;

There we go!