Skip to content

Commit

Permalink
Fix ActiveDataProviderTest::testPaginationBeforeModels
Browse files Browse the repository at this point in the history
  • Loading branch information
lav45 committed Nov 17, 2023
1 parent 7fa103c commit 92dcb03
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions framework/data/BaseDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,15 @@ public function getPagination()
public function setPagination($value)
{
if (is_array($value)) {
$config = [
'class' => Pagination::className(),
'totalCount' => $this->getTotalCount(),
];
$config = ['class' => Pagination::className()];
if ($this->id !== null) {
$config['pageParam'] = $this->id . '-page';
$config['pageSizeParam'] = $this->id . '-per-page';
}
$this->_pagination = Yii::createObject(array_merge($config, $value));
} elseif ($value instanceof Pagination || $value === false) {
$value = Yii::createObject(array_merge($config, $value));
}
if ($value instanceof Pagination || $value === false) {
$value->totalCount = $this->getTotalCount();
$this->_pagination = $value;
} else {
throw new InvalidArgumentException('Only Pagination instance, configuration array or false is allowed.');
Expand Down

0 comments on commit 92dcb03

Please sign in to comment.