function BatchBuilder::setQueue
Same name in other branches
- 9 core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setQueue()
- 8.9.x core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setQueue()
- 11.x core/lib/Drupal/Core/Batch/BatchBuilder.php \Drupal\Core\Batch\BatchBuilder::setQueue()
Sets an override for the default queue.
The class will typically either be \Drupal\Core\Queue\Batch or \Drupal\Core\Queue\BatchMemory. The class defaults to Batch if progressive is TRUE, or to BatchMemory if progressive is FALSE.
Parameters
string $name: The unique identifier for the queue.
string $class: The fully qualified name of a class that implements \Drupal\Core\Queue\QueueInterface.
Return value
$this
File
-
core/
lib/ Drupal/ Core/ Batch/ BatchBuilder.php, line 287
Class
- BatchBuilder
- Builds an array for a batch process.
Namespace
Drupal\Core\BatchCode
public function setQueue($name, $class) {
if (!class_exists($class)) {
throw new \InvalidArgumentException('Class ' . $class . ' does not exist.');
}
if (!in_array(QueueInterface::class, class_implements($class))) {
throw new \InvalidArgumentException('Class ' . $class . ' does not implement \\Drupal\\Core\\Queue\\QueueInterface.');
}
$this->queue = [
'name' => $name,
'class' => $class,
];
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.