It can help us to debug Sql query in some case when yii debug is not work.
Example:
$listBooks = Books::find()->where('author=2')->all();
To get raw SQL query with all parameters included try:
$query = Books::find()->where('author=2'); echo $query->createCommand()->sql; echo $query->createCommand()->getRawSql();
It not only works with Activerecord .
Refer : http://chris-backhouse.com/Yii2-Output-the-SQL-from-a-query-builder/1027
nice
ReplyDeletevery
ReplyDelete