function ItemStorage::executeFeedItemQuery

Same name in other branches
  1. 9 core/modules/aggregator/src/ItemStorage.php \Drupal\aggregator\ItemStorage::executeFeedItemQuery()

Helper method to execute an item query.

Parameters

\Drupal\Core\Entity\Query\QueryInterface $query: The query to execute.

int $limit: (optional) The number of items to return.

Return value

\Drupal\aggregator\ItemInterface[] An array of the feed items.

2 calls to ItemStorage::executeFeedItemQuery()
ItemStorage::loadAll in core/modules/aggregator/src/ItemStorage.php
Loads feed items from all feeds.
ItemStorage::loadByFeed in core/modules/aggregator/src/ItemStorage.php
Loads feed items filtered by a feed.

File

core/modules/aggregator/src/ItemStorage.php, line 55

Class

ItemStorage
Controller class for aggregators items.

Namespace

Drupal\aggregator

Code

protected function executeFeedItemQuery(QueryInterface $query, $limit) {
    $query->sort('timestamp', 'DESC')
        ->sort('iid', 'DESC');
    if (!empty($limit)) {
        $query->pager($limit);
    }
    return $this->loadMultiple($query->execute());
}

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