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);
}
}
I am getting error like this. Any help will be appreciable Thanks.