public static function run($session_ids, &$context) {
    if (empty($context['sandbox'])) {
      // Perform set-up steps here.
      $context['sandbox']['progress'] = 0;
      $context['sandbox']['max'] = count($session_ids);
    }
    $items_per_iteration = 1;

    $nids = array_slice($session_ids, $context['sandbox']['progress'], $items_per_iteration);
    $sessions = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->loadMultiple($nids);
    $session_instance_manager = \Drupal::service('session_instance.manager');
    foreach ($sessions as $session) {
      $session_instance_manager->recreateSessionInstances($session);
      $context['sandbox']['progress']++;
      $context['results'][] = $session->id();
    }

    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
public static function run($session_ids, &$context) {
    if (empty($context['sandbox'])) {
      // Perform set-up steps here.
      $context['sandbox']['progress'] = 0;
      $context['sandbox']['max'] = count($session_ids);
    }
    $items_per_iteration = 1;

    $nids = array_slice($session_ids, $context['sandbox']['progress'], $items_per_iteration);
    $sessions = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->loadMultiple($nids);
    $session_instance_manager = \Drupal::service('session_instance.manager');
    foreach ($sessions as $session) {
      $session_instance_manager->recreateSessionInstances($session);
      $context['sandbox']['progress']++;
      $context['results'][] = $session->id();
    }

    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
public static function run ( $ session_ids , & $ context ) { if ( empty ( $ context [ 'sandbox' ] ) ) { // Perform set-up steps here. $ context [ 'sandbox' ] [ 'progress' ] = 0 ; $ context [ 'sandbox' ] [ 'max' ] = count ( $ session_ids ) ; } $ items_per_iteration = 1 ; $ nids = array_slice ( $ session_ids , $ context [ 'sandbox' ] [ 'progress' ] , $ items_per_iteration ) ; $ sessions = \ Drupal :: entityTypeManager ( ) -> getStorage ( 'node' ) -> loadMultiple ( $ nids ) ; $ session_instance_manager = \ Drupal :: service ( 'session_instance.manager' ) ; foreach ( $ sessions as $ session ) { $ session_instance_manager -> recreateSessionInstances ( $ session ) ; $ context [ 'sandbox' ] [ 'progress' ] ++ ; $ context [ 'results' ] [ ] = $ session -> id ( ) ; } $ context [ 'finished' ] = $ context [ 'sandbox' ] [ 'progress' ] / $ context [ 'sandbox' ] [ 'max' ] ; }
Batch process sessions instance actualization.

@param $session_ids array
Session IDs array.
@param $context array
Context array.
Batch process sessions instance actualization .