Skip to content

Commit

Permalink
[DOCS] Adjust scheduler API docs to reflect new SchedulerTaskRepository
Browse files Browse the repository at this point in the history
With https://review.typo3.org/c/Packages/TYPO3.CMS/+/78197 the
methods for reading and writing to the database were moved to
a dedicated repository. The documentation does not reflect this
change in the "Scheduler API" chapter.

Resolves: #101062
Resolves: TYPO3-Documentation/Changelog-To-Doc#526
Resolves: TYPO3-Documentation/Changelog-To-Doc#405
Related: #101040
Related: #100247
Releases: main, 12.4
Change-Id: I871bd54e41882c35eaaeeb325c8bed5c2dd1b2e7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79388
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
brotkrueml authored and lolli42 committed Jun 14, 2023
1 parent 38b79f5 commit d41e889
Showing 1 changed file with 18 additions and 22 deletions.
@@ -1,35 +1,31 @@
.. include:: /Includes.rst.txt
.. include:: /Includes.rst.txt

.. _scheduler-api:


.. _scheduler-api:

=============
Scheduler API
^^^^^^^^^^^^^
=============

It is possible to refer to the Scheduler from other extensions. Once a
:code:`\TYPO3\CMS\Scheduler\Scheduler` 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. It would be excessive to
describe them all here.
:php:`\TYPO3\CMS\Scheduler\Scheduler` 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.

However a few deserve a special mention:
The extension ships with a
:php:`\TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository` class,
which provides some helpful methods, for example:

- :code:`fetchTask()` : this method is used to fetch a registered task
from the database given an id. If no id is given, it will return the
next due task. The return value is the unserialized task object.
* :php:`findByUid(int $uid)`: this method is used to fetch a registered task
from the database given an ID.

- :code:`fetchTaskRecord()` : 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. It is not designed fetch
the next due task.
* :php:`findNextExecutableTask()`: this method returns the next due task. The
return value is the unserialized task object.

- :code:`fetchTasksWithCondition()` : can be used to retrieve one or
more registered tasks, that fit a given SQL condition. It returns an
array containing all the records of the matching tasks registrations.
* :php:`findRecordByUid(int $uid)`: 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.

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
:code:`\TYPO3\CMS\Scheduler\Task\AbstractTask` class can be used.

:php:`\TYPO3\CMS\Scheduler\Task\AbstractTask` class can be used.

0 comments on commit d41e889

Please sign in to comment.