Yii - How to print SQL used by findAll
问题 I have the following code to get some records from db $criteria = new CDbCriteria(); $criteria->condition = 't.date BETWEEN "'.$from_date.'" AND "'.$to_date.'"'; $criteria->with = array('order'); $orders = ProductOrder::model()->findAll($criteria); Is it possible to get the SQL that is used by the findAll? I know you can get it from the debug console. But I'm running the script in the background using yiic.php 回答1: You can log the executed queries in the application log and review that.