function EntityListBuilder::getEntityListQuery

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::getEntityListQuery()

Returns a query object for loading entity IDs from the storage.

Return value

\Drupal\Core\Entity\Query\QueryInterface A query object used to load entity IDs.

File

core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 108

Class

EntityListBuilder
Defines a generic implementation to build a listing of entities.

Namespace

Drupal\Core\Entity

Code

protected function getEntityListQuery() : QueryInterface {
    $query = $this->getStorage()
        ->getQuery()
        ->accessCheck(TRUE)
        ->sort($this->entityType
        ->getKey('id'));
    // Only add the pager if a limit is specified.
    if ($this->limit) {
        $query->pager($this->limit);
    }
    return $query;
}

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