function BatchStorage::create

Creates and saves a batch.

Parameters

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

Overrides BatchStorageInterface::create

File

drupal/core/lib/Drupal/Core/Utility/BatchStorage.php, line 69
Contains \Drupal\Core\Utility\BatchStorage.

Class

BatchStorage

Namespace

Drupal\Core\Utility

Code

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