Show raw SQL query

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

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

or to get the SQL with all parameters included try:


Thanks to

19 1
Viewed: 242 342 times
Version: 2.0
Category: FAQs
Written by: darioo
Last updated by: darioo
Created on: Jan 14, 2017
Last updated: 7 years ago
Update Article


View all history