- Issue created by @alvarito75
- 🇮🇳India dev16.addweb
Yes, your implementation looks good. Placing this code inside your custom_module.module file within the hook_cron() implementation will ensure that the recreate() method of the entity_usage.batch_manager service is called during each cron run.
1.) Define the function
2.) Implement hook_cron()
3.) Call the function within hook_cron()
4.) Set the cron frequency/** * Implements hook_cron(). */ function custom_module_cron() { // Recreate the entity usage batch manager service. $entityUsageBatchManager = \Drupal::service('entity_usage.batch_manager'); // Call the recreate method if it exists. if (method_exists($entityUsageBatchManager, 'recreate')) { $entityUsageBatchManager->recreate(); } }