Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Queue/Batch.php
- 9 core/lib/Drupal/Core/Queue/Batch.php
Namespace
Drupal\Core\Queue
File
core/lib/Drupal/Core/Queue/Batch.php
View source
<?php
namespace Drupal\Core\Queue;
class Batch extends DatabaseQueue {
public function claimItem($lease_time = 0) {
try {
$item = $this->connection
->queryRange('SELECT [data], [item_id] FROM {queue} q WHERE [name] = :name ORDER BY [item_id] ASC', 0, 1, [
':name' => $this->name,
])
->fetchObject();
if ($item) {
$item->data = unserialize($item->data);
return $item;
}
} catch (\Exception $e) {
$this
->catchException($e);
}
return FALSE;
}
public function getAllItems() {
$result = [];
try {
$items = $this->connection
->query('SELECT [data] FROM {queue} q WHERE [name] = :name ORDER BY [item_id] ASC', [
':name' => $this->name,
])
->fetchAll();
foreach ($items as $item) {
$result[] = unserialize($item->data);
}
} catch (\Exception $e) {
$this
->catchException($e);
}
return $result;
}
}
Classes
Name |
Description |
Batch |
Defines a batch queue handler used by the Batch API. |