You are here

protected function BatchStorage::doCreate in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Batch/BatchStorage.php \Drupal\Core\Batch\BatchStorage::doCreate()

Saves a batch.

Parameters

array $batch: The array representing the batch to create.

1 call to BatchStorage::doCreate()
BatchStorage::create in core/lib/Drupal/Core/Batch/BatchStorage.php
Creates and saves a batch.

File

core/lib/Drupal/Core/Batch/BatchStorage.php, line 151

Class

BatchStorage

Namespace

Drupal\Core\Batch

Code

protected function doCreate(array $batch) {
  $this->connection
    ->insert('batch')
    ->fields([
    'bid' => $batch['id'],
    'timestamp' => REQUEST_TIME,
    'token' => $this->csrfToken
      ->get($batch['id']),
    'batch' => serialize($batch),
  ])
    ->execute();
}