yii\data\ActiveDataProvider::prepareTotalCount PHP Method

prepareTotalCount() protected method

protected prepareTotalCount ( )
    protected function prepareTotalCount()
    {
        if (!$this->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.');
        }
        $query = clone $this->query;
        return (int) $query->limit(-1)->offset(-1)->orderBy([])->count('*', $this->db);
    }

Usage Example

 /**
  * @inheritdoc
  */
 protected function prepareTotalCount()
 {
     $origQuery = $this->query;
     $this->modifyQuery($this->query);
     $r = parent::prepareTotalCount();
     $this->query = $origQuery;
     return $r;
 }
All Usage Examples Of yii\data\ActiveDataProvider::prepareTotalCount