query instanceof QueryInterface) { throw new InvalidConfigException('The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.'); } if (($pagination = $this->getPagination()) !== false) { $pagination->totalCount = $this->getTotalCount(); $this->query->limit($pagination->getLimit())->offset($pagination->getOffset()); } if (($sort = $this->getSort()) !== false) { $this->query->addOrderBy($sort->getOrders()); } return $this; } }