yiisoft/yii2 · error · InvalidArgumentException
Only Pagination instance, configuration array or false is al
Error message
Only Pagination instance, configuration array or false is allowed.
What it means
Error "Only Pagination instance, configuration array or false is allowed." thrown in yiisoft/yii2.
Source
Thrown at framework/data/BaseDataProvider.php:230
* to 'yii\data\Pagination'
* - an instance of [[Pagination]] or its subclass
* - false, if pagination needs to be disabled.
*
* @throws InvalidArgumentException
*/
public function setPagination($value)
{
if (is_array($value)) {
$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) {
$this->_pagination = $value;
} else {
throw new InvalidArgumentException('Only Pagination instance, configuration array or false is allowed.');
}
}
/**
* Returns the sorting object used by this data provider.
* @return Sort|bool the sorting object. If this is false, it means the sorting is disabled.
*/
public function getSort()
{
if ($this->_sort === null) {
$this->setSort([]);
}
return $this->_sort;
}
/**
* Sets the sort definition for this data provider.View on GitHub (pinned to 66f00d18a2)
When it happens
Trigger: Thrown at framework/data/BaseDataProvider.php:230 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of yiisoft/yii2@66f00d18a2 (2026-08-17).
Data as JSON: /api/errors/fdb2ee90ae029fe7.
Report an issue: GitHub.