function BatchStorage::doCreate

Same name and namespace in other branches
  1. 9 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.