/** * Sets the pagination for this data provider. * @param array|Pagination|boolean $value The pagination to be used by this data provider. * This can be one of the following: * * - a configuration array for creating the pagination object. The "class" element defaults * to 'UrbanIndo\Yii2\DynamoDb\Pagination' * - an instance of [[Pagination]] or its subclass * - false, if pagination needs to be disabled. * * @throws InvalidParamException When the value is not Pagination instance. * @return void */ public function setPagination($value) { if (is_array($value)) { $config = ['class' => Pagination::className()]; if ($this->id !== null) { $config['pageSizeParam'] = $this->id . '-per-page'; } parent::setPagination(Yii::createObject(array_merge($config, $value))); } elseif ($value instanceof Pagination || $value === false) { parent::setPagination($value); } else { throw new InvalidParamException('Only Pagination instance, configuration array or false is allowed.'); } }