Feed::deleteItems

public Feed::deleteItems()

Deletes all items from a feed.

This will also reset the last checked and modified time of the feed and save it.

Return value

\Drupal\aggregator\FeedInterface The class instance that this method is called on.

Overrides FeedInterface::deleteItems

See also

\Drupal\aggregator\ItemsImporterInterface::delete()

File

core/modules/aggregator/src/Entity/Feed.php, line 60

Class

Feed
Defines the aggregator feed entity class.

Namespace

Drupal\aggregator\Entity

Code

public function deleteItems() {
  \Drupal::service('aggregator.items.importer')->delete($this);

  // Reset feed.
  $this->setLastCheckedTime(0);
  $this->setHash('');
  $this->setEtag('');
  $this->setLastModified(0);
  $this->save();

  return $this;
}
doc_Drupal
2016-10-29 09:09:54
Comments
Leave a Comment

Please login to continue.