ItemStorage.php in Drupal 8
File
core/modules/aggregator/src/ItemStorage.php
View source
<?php
namespace Drupal\aggregator;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
class ItemStorage extends SqlContentEntityStorage implements ItemStorageInterface {
public function getItemCount(FeedInterface $feed) {
$query = \Drupal::entityQuery('aggregator_item')
->condition('fid', $feed
->id())
->count();
return $query
->execute();
}
public function loadAll($limit = NULL) {
$query = \Drupal::entityQuery('aggregator_item');
return $this
->executeFeedItemQuery($query, $limit);
}
public function loadByFeed($fid, $limit = NULL) {
$query = \Drupal::entityQuery('aggregator_item')
->condition('fid', $fid);
return $this
->executeFeedItemQuery($query, $limit);
}
protected function executeFeedItemQuery(QueryInterface $query, $limit) {
$query
->sort('timestamp', 'DESC')
->sort('iid', 'DESC');
if (!empty($limit)) {
$query
->pager($limit);
}
return $this
->loadMultiple($query
->execute());
}
}