diff --git a/core/lib/Drupal/Core/Batch/BatchBuilder.php b/core/lib/Drupal/Core/Batch/BatchBuilder.php index 99bf194..45b7431 100644 --- a/core/lib/Drupal/Core/Batch/BatchBuilder.php +++ b/core/lib/Drupal/Core/Batch/BatchBuilder.php @@ -14,7 +14,7 @@ * foreach ($ids as $id) { * $batch_builder->addOperation('batch_example_callback', [$id]); * } - * $batch_builder->queue(); + * batch_set($batch_builder->toArray()); * @endcode */ class BatchBuilder implements BatchBuilderInterface { @@ -183,9 +183,8 @@ public function setProgressive($is_progressive = TRUE) { * {@inheritdoc} */ public function setQueue($name, $class) { - if ($name === NULL && $class === NULL) { - $this->queue = NULL; - return $this; + if (!class_exists($class)) { + throw new \InvalidArgumentException('Class ' . $class . ' does not exist.'); } $this->queue = [ @@ -216,14 +215,6 @@ public function addLibraries($libraries) { /** * {@inheritdoc} */ - public function queue() { - batch_set($this->toArray()); - return $this; - } - - /** - * {@inheritdoc} - */ public function toArray() { $array = [ 'operations' => $this->operations ?: [], diff --git a/core/lib/Drupal/Core/Batch/BatchBuilderInterface.php b/core/lib/Drupal/Core/Batch/BatchBuilderInterface.php index dbf4acb..8a5b1ea 100644 --- a/core/lib/Drupal/Core/Batch/BatchBuilderInterface.php +++ b/core/lib/Drupal/Core/Batch/BatchBuilderInterface.php @@ -117,10 +117,8 @@ public function setProgressive($is_progressive = TRUE); * @param string $name * The unique identifier for the queue. * @param string $class - * The name of a class that implements \Drupal\Core\Queue\QueueInterface, - * including the full namespace but not starting with a backslash. It must - * have a constructor with two arguments: $name and a - * \Drupal\Core\Database\Connection object. Typically, the class will either + * The fully qualified name of a class that implements + * \Drupal\Core\Queue\QueueInterface. Typically, the class will either * be \Drupal\Core\Queue\Batch or \Drupal\Core\Queue\BatchMemory. Defaults * to Batch if progressive is TRUE, or to BatchMemory if progressive is * FALSE. @@ -152,13 +150,6 @@ public function addOperation(callable $callback, array $arguments = []); public function addLibraries($libraries); /** - * Places the batch in the queue to be processed. - * - * @return $this - */ - public function queue(); - - /** * Converts a \Drupal\Core\Batch\Batch object into an array. * * @return array