/** * Helper method to execute an item query. * * @param \Drupal\Core\Entity\Query\QueryInterface $query * The query to execute. * @param int $limit * (optional) The number of items to return. * * @return \Drupal\aggregator\ItemInterface[] * An array of the feed items. */ protected function executeFeedItemQuery(QueryInterface $query, $limit) { $query->sort('timestamp', 'DESC')->sort('iid', 'DESC'); if (!empty($limit)) { $query->pager($limit); } return $this->loadMultiple($query->execute()); }