SchedulerTaskRepository
Repository class to fetch tasks available in the systems ready to be executed
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Constants
- TABLE_NAME = 'tx_scheduler_task'
Properties
Methods
- __construct() : mixed
- add() : bool
- Adds a task to the pool
- addExecutionToTask() : int
- This method adds current execution to the execution list.
- findByUid() : AbstractTask
- Fetches and unserializes a task object from the db with the given $uid. The object representing the next due task is returned.
- findNextExecutableTask() : AbstractTask
- Fetch and unserialize a task object from the db. Returns the object representing the next due task is returned. If there are no due tasks the method throws an exception.
- findNextExecutableTaskForUid() : AbstractTask|null
- Fetch and unserialize task objects selected with some (SQL) condition
- findRecordByUid() : array<string|int, mixed>|null
- This method is used to get the database record for a given task It returns the database record and not the task object
- getGroupedTasks() : array<string|int, mixed>
- hasTasks() : bool
- See if there are any tasks configured at all.
- isTaskMarkedAsRunning() : bool
- remove() : bool
- Removes a task completely from the system.
- removeAllRegisteredExecutionsForTask() : bool
- Clears all marked executions
- removeExecutionOfTask() : void
- Removes given execution from list
- update() : bool
- Update a task in the pool.
- createValidTaskObjectOrDisableTask() : AbstractTask
- isValidTaskObject() : bool
Constants
TABLE_NAME
protected
mixed
TABLE_NAME
= 'tx_scheduler_task'
Properties
$taskSerializer read-only
protected
TaskSerializer
$taskSerializer
Methods
__construct()
public
__construct(TaskSerializer $taskSerializer) : mixed
Parameters
- $taskSerializer : TaskSerializer
add()
Adds a task to the pool
public
add(AbstractTask $task) : bool
Parameters
- $task : AbstractTask
-
The object representing the task to add
Return values
bool —TRUE if the task was successfully added, FALSE otherwise
addExecutionToTask()
This method adds current execution to the execution list.
public
addExecutionToTask(AbstractTask $task) : int
It also logs the execution time and mode
Parameters
- $task : AbstractTask
Return values
int —Execution id
findByUid()
Fetches and unserializes a task object from the db with the given $uid. The object representing the next due task is returned.
public
findByUid(int $uid) : AbstractTask
If there are no due tasks the method throws an exception.
Parameters
- $uid : int
-
Primary key of a task
Tags
Return values
AbstractTaskfindNextExecutableTask()
Fetch and unserialize a task object from the db. Returns the object representing the next due task is returned. If there are no due tasks the method throws an exception.
public
findNextExecutableTask() : AbstractTask
Tags
Return values
AbstractTask —The fetched task object
findNextExecutableTaskForUid()
Fetch and unserialize task objects selected with some (SQL) condition
public
findNextExecutableTaskForUid(int $uid) : AbstractTask|null
Parameters
- $uid : int
Return values
AbstractTask|nullfindRecordByUid()
This method is used to get the database record for a given task It returns the database record and not the task object
public
findRecordByUid(int $uid) : array<string|int, mixed>|null
Parameters
- $uid : int
-
Primary key of the task to get
Tags
Return values
array<string|int, mixed>|null —Database record for the task
getGroupedTasks()
public
getGroupedTasks() : array<string|int, mixed>
This will get split up into errored classes
Return values
array<string|int, mixed>hasTasks()
See if there are any tasks configured at all.
public
hasTasks() : bool
Return values
boolisTaskMarkedAsRunning()
public
isTaskMarkedAsRunning(AbstractTask $task) : bool
Parameters
- $task : AbstractTask
Return values
boolremove()
Removes a task completely from the system.
public
remove(int|AbstractTask $task) : bool
Parameters
- $task : int|AbstractTask
-
The object representing the task to delete
Return values
bool —TRUE if task was successfully deleted, FALSE otherwise
removeAllRegisteredExecutionsForTask()
Clears all marked executions
public
removeAllRegisteredExecutionsForTask(AbstractTask $task) : bool
Parameters
- $task : AbstractTask
Return values
bool —TRUE if the clearing succeeded, FALSE otherwise
removeExecutionOfTask()
Removes given execution from list
public
removeExecutionOfTask(AbstractTask $task, int $executionID[, string|array<string|int, mixed>|null $failureReason = null ]) : void
Parameters
- $task : AbstractTask
- $executionID : int
-
Id of the execution to remove.
- $failureReason : string|array<string|int, mixed>|null = null
-
Details of an exception to signal a failed execution
update()
Update a task in the pool.
public
update(AbstractTask $task) : bool
Parameters
- $task : AbstractTask
Return values
boolcreateValidTaskObjectOrDisableTask()
protected
createValidTaskObjectOrDisableTask(array<string|int, mixed> $row) : AbstractTask
Parameters
- $row : array<string|int, mixed>
Return values
AbstractTaskisValidTaskObject()
protected
isValidTaskObject(mixed $task) : bool
Parameters
- $task : mixed