mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-08 08:17:24 +01:00
Fix #20055: Fix Response header X-Pagination-Total-Count is always 0
This commit is contained in:
@@ -87,14 +87,10 @@ class ArrayDataProvider extends BaseDataProvider
|
||||
$models = $this->sortModels($models, $sort);
|
||||
}
|
||||
|
||||
if (($pagination = $this->getPagination()) !== false) {
|
||||
$pagination->totalCount = $this->getTotalCount();
|
||||
|
||||
if ($pagination->getPageSize() > 0) {
|
||||
$models = array_slice($models, $pagination->getOffset(), $pagination->getLimit(), true);
|
||||
}
|
||||
$pagination = $this->getPagination();
|
||||
if ($pagination !== false && $pagination->getPageSize() > 0) {
|
||||
$models = array_slice($models, $pagination->getOffset(), $pagination->getLimit(), true);
|
||||
}
|
||||
|
||||
return $models;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user