public function SimpleSitemapQueue::yieldItem in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 src/Queue/SimplesitemapQueue.php \Drupal\simple_sitemap\Queue\SimplesitemapQueue::yieldItem()
Gets a simple_sitemap queue item in a very efficient way.
Return value
\Generator A queue item object with at least the following properties:
- data: the same as what what passed into createItem().
- item_id: the unique ID returned from createItem().
- created: timestamp when the item was put into the queue.
Throws
\Exception
See also
\Drupal\Core\Queue\QueueInterface::claimItem
File
- src/
Queue/ SimpleSitemapQueue.php, line 63
Class
- SimpleSitemapQueue
- Class SimpleSitemapQueue
Namespace
Drupal\simple_sitemap\QueueCode
public function yieldItem() : \Generator {
try {
$query = $this->connection
->query('SELECT data, item_id FROM {queue} q WHERE name = :name ORDER BY item_id ASC', [
':name' => $this->name,
]);
while ($item = $query
->fetchObject()) {
$item->data = unserialize($item->data);
(yield $item);
}
} catch (\Exception $e) {
$this
->catchException($e);
}
}