Skip to main content

I am doing batch process in D8. here is my code: This code is in Controller.php $batch = array( 'title' => t('Started Importing node Data.'), 'error_message' => t('Error!'), //Error Message 'finished' => 'node_data_import_batch_finished', ); $count_nodes = ''; $j = 0; $data_chunk = array_chunk($csv, 100); foreach ($data_chunk as $node_created) { $count_nodes += count($node_created); $batch['operations'][] = array('node_data_import_batch', array($node_created, $keys)); $j++; } batch_set($batch);

$batch = array(
          'title' => t('Started Importing node Data.'),
          'error_message' => t('Error!'), //Error Message
          'finished' => 'node_data_import_batch_finished',
        );
        $count_nodes = '';
        $j = 0;
        $data_chunk = array_chunk($csv, 100);
        foreach ($data_chunk as $node_created) {
          $count_nodes += count($node_created);
          $batch['operations'][] = array('node_data_import_batch', array($node_created,  $keys));
          $j++;
        }
        batch_set($batch);

And callback function is in .module

function node_data_import_batch($node_created, $keys){ //Code here }

function node_data_import_batch_finished($success, $results, $operations){ if ($success) { $message = "Batch Process Successfully executed for Node Data."; drupal_set_message($message); } }

function node_data_import_batch($node_created,  $keys){
//Code here
}

function node_data_import_batch_finished($success, $results, $operations){
 if ($success) {
    $message = "Batch Process Successfully executed for Node Data.";
    drupal_set_message($message);
  }
}

enter image description here

I am getting error like this. Any help will be appreciable Thanks.

I am doing batch process in D8. here is my code: This code is in Controller.php $batch = array( 'title' => t('Started Importing node Data.'), 'error_message' => t('Error!'), //Error Message 'finished' => 'node_data_import_batch_finished', ); $count_nodes = ''; $j = 0; $data_chunk = array_chunk($csv, 100); foreach ($data_chunk as $node_created) { $count_nodes += count($node_created); $batch['operations'][] = array('node_data_import_batch', array($node_created, $keys)); $j++; } batch_set($batch);

And callback function is in .module

function node_data_import_batch($node_created, $keys){ //Code here }

function node_data_import_batch_finished($success, $results, $operations){ if ($success) { $message = "Batch Process Successfully executed for Node Data."; drupal_set_message($message); } }

enter image description here

I am getting error like this. Any help will be appreciable Thanks.

I am doing batch process in D8. here is my code: This code is in Controller.php

$batch = array(
          'title' => t('Started Importing node Data.'),
          'error_message' => t('Error!'), //Error Message
          'finished' => 'node_data_import_batch_finished',
        );
        $count_nodes = '';
        $j = 0;
        $data_chunk = array_chunk($csv, 100);
        foreach ($data_chunk as $node_created) {
          $count_nodes += count($node_created);
          $batch['operations'][] = array('node_data_import_batch', array($node_created,  $keys));
          $j++;
        }
        batch_set($batch);

And callback function is in .module

function node_data_import_batch($node_created,  $keys){
//Code here
}

function node_data_import_batch_finished($success, $results, $operations){
 if ($success) {
    $message = "Batch Process Successfully executed for Node Data.";
    drupal_set_message($message);
  }
}

enter image description here

I am getting error like this. Any help will be appreciable Thanks.

Source Link
Ajay Reddy
  • 3.9k
  • 2
  • 25
  • 38

How to solve claimitem() in batch process?

I am doing batch process in D8. here is my code: This code is in Controller.php $batch = array( 'title' => t('Started Importing node Data.'), 'error_message' => t('Error!'), //Error Message 'finished' => 'node_data_import_batch_finished', ); $count_nodes = ''; $j = 0; $data_chunk = array_chunk($csv, 100); foreach ($data_chunk as $node_created) { $count_nodes += count($node_created); $batch['operations'][] = array('node_data_import_batch', array($node_created, $keys)); $j++; } batch_set($batch);

And callback function is in .module

function node_data_import_batch($node_created, $keys){ //Code here }

function node_data_import_batch_finished($success, $results, $operations){ if ($success) { $message = "Batch Process Successfully executed for Node Data."; drupal_set_message($message); } }

enter image description here

I am getting error like this. Any help will be appreciable Thanks.