function PagerSelectExtender::setCountQuery

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php \Drupal\Core\Database\Query\PagerSelectExtender::setCountQuery()
  2. 8.9.x core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php \Drupal\Core\Database\Query\PagerSelectExtender::setCountQuery()
  3. 10 core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php \Drupal\Core\Database\Query\PagerSelectExtender::setCountQuery()

Specify the count query object to use for this pager.

You will rarely need to specify a count query directly. If not specified, one is generated off of the pager query itself.

Parameters

\Drupal\Core\Database\Query\SelectInterface $query: The count query object. It must return a single row with a single column, which is the total number of records.

File

core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php, line 106

Class

PagerSelectExtender
Query extender for pager queries.

Namespace

Drupal\Core\Database\Query

Code

public function setCountQuery(SelectInterface $query) {
    $this->customCountQuery = $query;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.