Scheduler API
It is possible to refer to the Scheduler from other extensions. Once a
\TYPO3\ object has been instantiated all of its
public methods can be used. The PHPdoc of the methods should be enough to
understand what each is to be used for.
The extension ships with a
\TYPO3\ class,
which provides some helpful methods, for example:
find: this method is used to fetch a registered task from the database given an ID. It throws anBy Uid (int $uid) \Outif no task with this ID exists.Of Bounds Exception find: this method returns the next due task. The return value is the unserialized task object, orNext Executable Task () nullif no task is due.find: is also used to retrieve a registered task from the database, but it returns the record corresponding to the task registration and not the task object itself.Record By Uid (int $uid)
These are the main methods that will be used from outside the
Scheduler as they can retrieve registered tasks from the database.
When a task has been fetched, all public methods from the
\TYPO3\ class can be used.
Invalid tasks
Changed in version 15.0 Breaking: #110637 - Scheduler repository throws InvalidTaskException
Before, the methods threw an
\Unexpected.
If a task cannot be deserialized or is otherwise invalid,
find
and
find throw an
\TYPO3\. The
Scheduler also disables the task, so that it is not selected for execution
again.
use TYPO3\CMS\Scheduler\Exception\InvalidTaskException;
try {
$task = $schedulerTaskRepository->findByUid($taskUid);
} catch (InvalidTaskException) {
// Handle the invalid task.
}