This is the code I am using.
$serviceClass = \Drupal::service('abcclass.service'); $batch = array( 'title' => t('Pushing updated.'), 'init_message' => t('Start Pushing.'), 'progress_message' => t('Completed @current step of @total.'), 'error_message' => t('Pushing has encountered an error.'), 'operations' => array( array(array($serviceClass , 'ebook_push_single_pdf'), $node->id()), ), 'finished' => array($serviceClass , 'ebook_push_finished'), ); batch_set($batch);
But it doesn't work. I checked log file and I get:
Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary.
Note that if I implement batch callbacks in same file, it works.
How can I fix the code?