Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BatchBuilder.php

function 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\Batch

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal