class ItemStorage
Defines the storage handler class for feed item entities.
This extends the base storage class, adding required special handling for feed item entities.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
- class \Drupal\Core\Entity\ContentEntityStorageBase extends \Drupal\Core\Entity\ContentEntityStorageInterface, \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface, \Drupal\Core\Entity\BundleEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage extends \Drupal\Core\Entity\Sql\SqlEntityStorageInterface, \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface, \Drupal\Core\Entity\EntityBundleListenerInterface implements \Drupal\Core\Entity\ContentEntityStorageBase
- class \Drupal\aggregator\ItemStorage extends \Drupal\aggregator\ItemStorageInterface implements \Drupal\Core\Entity\Sql\SqlContentEntityStorage
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage extends \Drupal\Core\Entity\Sql\SqlEntityStorageInterface, \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface, \Drupal\Core\Entity\EntityBundleListenerInterface implements \Drupal\Core\Entity\ContentEntityStorageBase
- class \Drupal\Core\Entity\ContentEntityStorageBase extends \Drupal\Core\Entity\ContentEntityStorageInterface, \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface, \Drupal\Core\Entity\BundleEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
Expanded class hierarchy of ItemStorage
File
-
core/
modules/ aggregator/ src/ ItemStorage.php, line 14
Namespace
Drupal\aggregatorView source
class ItemStorage extends SqlContentEntityStorage implements ItemStorageInterface {
/**
* {@inheritdoc}
*/
public function getItemCount(FeedInterface $feed) {
$query = \Drupal::entityQuery('aggregator_item')->accessCheck(FALSE)
->condition('fid', $feed->id())
->count();
return $query->execute();
}
/**
* {@inheritdoc}
*/
public function loadAll($limit = NULL) {
$query = \Drupal::entityQuery('aggregator_item');
return $this->executeFeedItemQuery($query, $limit);
}
/**
* {@inheritdoc}
*/
public function loadByFeed($fid, $limit = NULL) {
$query = \Drupal::entityQuery('aggregator_item')->condition('fid', $fid);
return $this->executeFeedItemQuery($query, $limit);
}
/**
* 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->accessCheck(FALSE)
->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.