Query
in package
Uses
UtilsProvider
Query jobs and transform them to a proper `Job` instance.
Table of Contents
Properties
- $core : mixed
Methods
- __construct() : mixed
- C'tor.
- fetchById() : Job|null
- Fetch a single job by ID.
- getPluginConstantPrefix() : string
- Get the prefix of this package so we can utils package natively.
- read() : array<string|int, Job>
- Read jobs and cast them to proper `Job` instance.
- readCurrentJobs() : mixed
- Read current jobs per type.
- readRemaining() : mixed
- Read remaining jobs per type. This does not count failed jobs! The result is an associative array:
- setupConstants() : mixed
- Make sure the REAL_QUEUE constants are available.
- castRows() : mixed
- Cast read jobs to `Job` instance.
- lockUntil() : mixed
- Lock a set of jobs by a given time of seconds.
Properties
$core
private
mixed
$core
Methods
__construct()
C'tor.
public
__construct(Core $core) : mixed
Parameters
- $core : Core
Tags
fetchById()
Fetch a single job by ID.
public
fetchById(int $id) : Job|null
Parameters
- $id : int
Return values
Job|nullgetPluginConstantPrefix()
Get the prefix of this package so we can utils package natively.
public
getPluginConstantPrefix() : string
Return values
stringread()
Read jobs and cast them to proper `Job` instance.
public
read([array<string|int, mixed> $args = [] ]) : array<string|int, Job>
Arguments:
-
[limit]
-
[type=all|pending|failure]
-
[jobType]
-
[dataContains]
Allows you in a very basic way to check if a job exists bydata LIKE '%YOUR_STRING%'
-
[ids]
An array of Job ids which should be read -
[omitClientData=false]
Iftrue
,data
will be omitted forserver
workers -
[after]
Read all job ids after that one -
[lockUntil=0]
Add this seconds to UNIX-timestamp and mark the read jobs as locked_until
Parameters
- $args : array<string|int, mixed> = []
Return values
array<string|int, Job>readCurrentJobs()
Read current jobs per type.
public
readCurrentJobs([bool $omitClientData = false ]) : mixed
Parameters
- $omitClientData : bool = false
readRemaining()
Read remaining jobs per type. This does not count failed jobs! The result is an associative array:
public
readRemaining() : mixed
[type: string]: [remaining: number, total: number, failure: number]
setupConstants()
Make sure the REAL_QUEUE constants are available.
public
static setupConstants() : mixed
castRows()
Cast read jobs to `Job` instance.
protected
castRows(array<string|int, mixed> &$rows) : mixed
Parameters
- $rows : array<string|int, mixed>
lockUntil()
Lock a set of jobs by a given time of seconds.
protected
lockUntil(array<string|int, int> $ids, int $seconds) : mixed
Parameters
- $ids : array<string|int, int>
- $seconds : int