You are here

protected function MultiversionStorageSchemaConverter::initializeConversion in Multiversion 8.2

Parameters

array $sandbox:

1 call to MultiversionStorageSchemaConverter::initializeConversion()
MultiversionStorageSchemaConverter::convertToMultiversionable in src/Entity/Storage/Sql/MultiversionStorageSchemaConverter.php

File

src/Entity/Storage/Sql/MultiversionStorageSchemaConverter.php, line 321

Class

MultiversionStorageSchemaConverter

Namespace

Drupal\multiversion\Entity\Storage\Sql

Code

protected function initializeConversion(array &$sandbox) {

  // If 'progress' is not set, then this will be the first run of the batch.
  if (!isset($sandbox['progress'])) {
    $max = 0;
    foreach ($sandbox['base_tables'] as $entity_type_id => $base_table) {
      $entities_count = $this->database
        ->select($sandbox['base_tables'][$entity_type_id])
        ->countQuery()
        ->execute()
        ->fetchField();
      $sandbox[$entity_type_id]['max'] = (int) $entities_count;
      $max += $entities_count;
    }
    $sandbox['current_id'] = 0;
    $sandbox['max'] = $max;
  }
}