I am trying to make a query to get the first 10 records for example, and pass it to the ActiveDataProvider.
The query is working fine and returning the required number of records only, while the ActiveDataProvider is printing all the records, here is my code:
$query = new \yii\db\Query;
$query->select('*')
->from('customers')
->limit(10);
$query->createCommand();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
Set Pagination to false :
$dataProvider = new ActiveDataProvider([
'pagination' => false
]);
Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With