mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-05 23:14:40 +01:00
Fix #20226: Revert all PR for "Data providers perform unnecessary COUNT queries that negatively affect performance"
This commit is contained in:
@@ -86,10 +86,14 @@ class ArrayDataProvider extends BaseDataProvider
|
||||
$models = $this->sortModels($models, $sort);
|
||||
}
|
||||
|
||||
$pagination = $this->getPagination();
|
||||
if ($pagination !== false && $pagination->getPageSize() > 0) {
|
||||
$models = array_slice($models, $pagination->getOffset(), $pagination->getLimit(), true);
|
||||
if (($pagination = $this->getPagination()) !== false) {
|
||||
$pagination->totalCount = $this->getTotalCount();
|
||||
|
||||
if ($pagination->getPageSize() > 0) {
|
||||
$models = array_slice($models, $pagination->getOffset(), $pagination->getLimit(), true);
|
||||
}
|
||||
}
|
||||
|
||||
return $models;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user