You are here

public function ContentHubImportQueue::process in Acquia Content Hub 8.2

Handle the route to create a batch process.

File

modules/acquia_contenthub_subscriber/src/ContentHubImportQueue.php, line 55

Class

ContentHubImportQueue
Implements an Import Queue for entities.

Namespace

Drupal\acquia_contenthub_subscriber

Code

public function process() {
  $batch = [
    'title' => $this
      ->t('Process all entities to be imported'),
    'operations' => [],
    'finished' => [
      [
        $this,
        'batchFinished',
      ],
      [],
    ],
  ];

  // Count number of the items in this queue, create enough batch operations.
  for ($i = 0; $i < $this
    ->getQueueCount(); $i++) {

    // Create batch operations.
    $batch['operations'][] = [
      [
        $this,
        'batchProcess',
      ],
      [],
    ];
  }

  // Adds the batch sets.
  batch_set($batch);
}