1. Yii2 obtains the sql statement executed by the current program:
$query = model::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pagesize' => '25',
]
]);
//Get the sql statement executed by the current program
$query->createCommand()->getRawSql();