ActiveDataProvider data based on yii\db\Query or yii\db\ActiveQuery.
It provides data by using DB queries using $query.
You can use ORDER BY, GROUP BY, LIMIT, OFFSET just like normal sql statements in ActiveDataProvider.
How to use active dataprovider in Yii2
use yii\data\ActiveDataProvider; $userQuery = User::find()->where(['id' => 9]); $provider = new ActiveDataProvider([ 'query' => $userQuery, 'pagination' => [ 'pageSize' => 5, ], 'sort' => [ 'defaultOrder' => [ 'updated_by' => SORT_DESC ] ], ]);
Nice Blog , This is what I exactly Looking for , Keep sharing more blog .
ReplyDeleteHire Yii Developers in India