public function PagerSelectExtender::setCountQuery

public PagerSelectExtender::setCountQuery(SelectInterface $query)

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 107

Class

PagerSelectExtender
Query extender for pager queries.

Namespace

Drupal\Core\Database\Query

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Query!PagerSelectExtender.php/function/PagerSelectExtender::setCountQuery/8.1.x