abstract class ScheduledJob extends Job implements ScheduledJobInterface, JobInterface

Base class for all scheduled jobs

Properties

protected string|integer|null $id Unique job id from Job
protected string|null $name Job name from Job
protected integer $priority Priority from Job
protected string|null $extension Extension name from Job
protected int $status Job status from Job
protected array $errors Execution errors from Job
protected int|null $dateExecuted Execution timestamp from Job
protected int|null $dateCreated Date added to queue from Job
protected string|null $queue Queue name from Job
protected array $params Job params from Job
protected integer $scheduleTime Scheduled date time (timestamp)

Methods

void
execute()

Job code

from Job
__construct(string|null $extension, string|null $name = null, array $params = [])

Constructor

void
setParam(string $name, mixed $value)

Set param

from Job
mixed
getParam(string $name, mixed $default = null)

Get param value

from Job
void
init()

Init job

from Job
array
toArray()

Convert to array

array
getErrors()

Get execution errors

from Job
void
addError(string $errorMessage)

Add error

from Job
bool
hasSuccess()

Return true if job is executed successful

from Job
int|null
getDateExecuted()

Get execution timestamp

from Job
int|null
getDateCreated()

Get date created

from Job
void
setDateExecuted(int|null $time)

Set execution date

from Job
void
setDateCreated(int|null $time)

Set date pused to queue

from Job
int
getStatus()

Get job status

from Job
void
setStatus(int $status)

Set job status

from Job
void
__set(string $name, mixed $value)

Set

from Job
void
setId(string|null $id)

Set id

from Job
string|null
getId()

Get id

from Job
string|null
getExtensionName()

Get extension name

from Job
string|null
getName()

Get name

from Job
int
getPriority()

Get priority

from Job
void
setName(string|null $name)

Set name

from Job
void
setPriority(int $priority)

Set priority

from Job
void
setExtensionName(string|null $name)

Set extension name

from Job
void
setQueue(string|null $name)

Set executuion Queue (null for any)

from Job
string|null
getQueue()

Get queue

from Job
int
getScheduleTime()

ScheduledJobInterface implementation

mixed
setScheduleTime(int $timestamp)

Set scheduled time (timestamp)

runAt(string $date)

Set scheduled time

bool
isDue()

Return true if job is due

Details

in Job at line 95
abstract void execute()

Job code

Return Value

void

at line 36
__construct(string|null $extension, string|null $name = null, array $params = [])

Constructor

Parameters

string|null $extension
string|null $name
array $params

in Job at line 125
void setParam(string $name, mixed $value)

Set param

Parameters

string $name
mixed $value

Return Value

void

in Job at line 137
mixed getParam(string $name, mixed $default = null)

Get param value

Parameters

string $name
mixed $default

Return Value

mixed

in Job at line 147
void init()

Init job

Return Value

void

at line 48
array toArray()

Convert to array

Return Value

array

in Job at line 177
array getErrors()

Get execution errors

Return Value

array

in Job at line 188
void addError(string $errorMessage)

Add error

Parameters

string $errorMessage

Return Value

void

in Job at line 198
bool hasSuccess()

Return true if job is executed successful

Return Value

bool

in Job at line 208
int|null getDateExecuted()

Get execution timestamp

Return Value

int|null

in Job at line 218
int|null getDateCreated()

Get date created

Return Value

int|null

in Job at line 229
void setDateExecuted(int|null $time)

Set execution date

Parameters

int|null $time timestamp

Return Value

void

in Job at line 240
void setDateCreated(int|null $time)

Set date pused to queue

Parameters

int|null $time timestamp

Return Value

void

in Job at line 250
int getStatus()

Get job status

Return Value

int

in Job at line 261
void setStatus(int $status)

Set job status

Parameters

int $status

Return Value

void

in Job at line 275
void __set(string $name, mixed $value)

Set

Parameters

string $name
mixed $value

Return Value

void

in Job at line 286
void setId(string|null $id)

Set id

Parameters

string|null $id

Return Value

void

in Job at line 296
string|null getId()

Get id

Return Value

string|null

in Job at line 306
string|null getExtensionName()

Get extension name

Return Value

string|null

in Job at line 316
string|null getName()

Get name

Return Value

string|null

in Job at line 326
int getPriority()

Get priority

Return Value

int

in Job at line 337
void setName(string|null $name)

Set name

Parameters

string|null $name

Return Value

void

in Job at line 348
void setPriority(int $priority)

Set priority

Parameters

int $priority

Return Value

void

in Job at line 359
void setExtensionName(string|null $name)

Set extension name

Parameters

string|null $name

Return Value

void

in Job at line 370
void setQueue(string|null $name)

Set executuion Queue (null for any)

Parameters

string|null $name

Return Value

void

in Job at line 380
string|null getQueue()

Get queue

Return Value

string|null

at line 61
int getScheduleTime()

ScheduledJobInterface implementation

Return Value

int

at line 72
mixed setScheduleTime(int $timestamp)

Set scheduled time (timestamp)

Parameters

int $timestamp

Return Value

mixed

at line 85
ScheduledJob runAt(string $date)

Set scheduled time

Parameters

string $date

Return Value

ScheduledJob

at line 95
bool isDue()

Return true if job is due

Return Value

bool