public function FeedExpireHandler::expireItem in Feeds 8.3
Expires a single item imported with the given feed.
Parameters
\Drupal\feeds\FeedInterface $feed: The feed for which to expire the item.
int $item_id: The ID of the item to expire. Usually this is an entity ID.
Return value
float The progress being made on expiring.
File
- src/
FeedExpireHandler.php, line 77
Class
- FeedExpireHandler
- Expires the items of a feed.
Namespace
Drupal\feedsCode
public function expireItem(FeedInterface $feed, $item_id) {
try {
$this
->dispatchEvent(FeedsEvents::INIT_EXPIRE, new InitEvent($feed));
$this
->dispatchEvent(FeedsEvents::EXPIRE, new ExpireEvent($feed, $item_id));
} catch (\RuntimeException $e) {
$this
->messenger()
->addError($e
->getMessage());
$feed
->clearStates();
$feed
->unlock();
} catch (\Exception $e) {
$feed
->clearStates();
$feed
->unlock();
throw $e;
}
return $feed
->progressExpiring();
}