document the various possibilities for the 'callback' property

Created on 12 February 2018, about 7 years ago
Updated 6 October 2023, over 1 year ago

Looking at getCallback() and resolveCallback(), the cron job entity's callback property can be any of:

- a PHP callable such as a function name, or a method on a class
- Controller in the service:method notation
- Controller in the class::method notation

This needs to be documented:

- on the CronJob::$callback property
- in the config schema
- in the README (which seems really out of date anyway, so would need a total rewrite as part of a more general issue)

🐛 Bug report
Status

Active

Version

2.0

Component

Documentation

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Today I had to use callbacks which I created in a service class and it works exactly how you described it.

    I had to look up the resolveCallback() method to better understand how it works but here's an example of how I implemented the service callback in my .yml file:

    callback: service_name:method

    Was pretty simple to implement. The only place where I was facing some difficulties is when I was trying to update the cron job that I already imported to my drupal website. I had to go through some loops of drush cex, drush deploy and clearing the cache from the UI also helped not making my cron job page crash. That last part is mostly due to my Docker setup but putting it out there in case someone else is facing the same issues.

  • Status changed to Fixed 3 months ago
  • 🇨🇭Switzerland berdir Switzerland

    This is now documented in the README.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024