CoolCMS API

CronJob extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Cron job known to the scheduler (`cms_system_cron_jobs`).

The catalog of jobs lives in code (CronJob); the row only holds what an administrator can change (frequency, enabled) and what the scheduler records (lastRunTime, lastStatus, …). path is the key (/cron/system/log/purge-old). Rows are created and updated by the scheduler, never through the generic Api save/delete.

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'cronJob'

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$available  : bool
$defaultFrequency  : string
$enabled  : bool
$frequency  : string
$id  : int|null
$lastDurationMs  : int|null
$lastResponse  : string|null
$lastRunTime  : DateTime|null
$lastStatus  : string|null
$moduleId  : int|null
$outbound  : bool
$path  : string

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getAvailable()  : bool
getDefaultFrequency()  : string
getEnabled()  : bool
getFrequency()  : string
getId()  : int|null
getLastDurationMs()  : int|null
getLastResponse()  : string|null
getLastRunTime()  : DateTime|null
getLastStatus()  : string|null
getModuleId()  : int|null
getOutbound()  : bool
getPath()  : string
isPersisted()  : bool
setAvailable()  : $this
setDefaultFrequency()  : $this
setEnabled()  : $this
setFrequency()  : $this
setId()  : $this
setLastDurationMs()  : $this
setLastResponse()  : $this
setLastRunTime()  : $this
setLastStatus()  : $this
setModuleId()  : $this
setOutbound()  : $this
setPath()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$available

protected bool $available = true
Attributes
#[Column]
$name: 'available'
$type: 'boolean'
$options: ['default' => true]
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$defaultFrequency

protected string $defaultFrequency = 'manual'
Attributes
#[Column]
$name: 'default_frequency'
$type: 'string'
$length: 40
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$enabled

protected bool $enabled = true
Attributes
#[Column]
$name: 'enabled'
$type: 'boolean'
$options: ['default' => true]

$frequency

protected string $frequency = 'manual'
Attributes
#[Column]
$name: 'frequency'
$type: 'string'
$length: 40

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'cron_job_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$lastDurationMs

protected int|null $lastDurationMs = null
Attributes
#[Column]
$name: 'last_duration_ms'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$lastResponse

protected string|null $lastResponse = null
Attributes
#[Column]
$name: 'last_response'
$type: 'string'
$length: 500
$nullable: true
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$lastRunTime

protected DateTime|null $lastRunTime = null
Attributes
#[Column]
$name: 'last_run_time'
$type: 'datetime'
$nullable: true
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$lastStatus

protected string|null $lastStatus = null
Attributes
#[Column]
$name: 'last_status'
$type: 'string'
$length: 10
$nullable: true
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$moduleId

protected int|null $moduleId = null
Attributes
#[Column]
$name: 'module_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$outbound

protected bool $outbound = false
Attributes
#[Column]
$name: 'outbound'
$type: 'boolean'
$options: ['default' => false]
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

$path

protected string $path = ''
Attributes
#[Column]
$name: 'path'
$type: 'string'
$length: 120
$unique: true
#[FieldAccess]
$read: Audience::All
$insert: Audience::None
$update: Audience::None

Methods

__construct()

public __construct([int|null $id = null ][, int|null $moduleId = null ][, string $path = '' ][, string $frequency = 'manual' ][, string $defaultFrequency = 'manual' ][, bool $enabled = true ][, bool $outbound = false ][, bool $available = true ][, DateTime|null $lastRunTime = null ][, string|null $lastStatus = null ][, int|null $lastDurationMs = null ][, string|null $lastResponse = null ]) : mixed
Parameters
$id : int|null = null
$moduleId : int|null = null
$path : string = ''
$frequency : string = 'manual'
$defaultFrequency : string = 'manual'
$enabled : bool = true
$outbound : bool = false
$available : bool = true
$lastRunTime : DateTime|null = null
$lastStatus : string|null = null
$lastDurationMs : int|null = null
$lastResponse : string|null = null

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getAvailable()

public getAvailable() : bool
Return values
bool

getDefaultFrequency()

public getDefaultFrequency() : string
Return values
string

getEnabled()

public getEnabled() : bool
Return values
bool

getFrequency()

public getFrequency() : string
Return values
string

getLastDurationMs()

public getLastDurationMs() : int|null
Return values
int|null

getLastResponse()

public getLastResponse() : string|null
Return values
string|null

getLastRunTime()

public getLastRunTime() : DateTime|null
Return values
DateTime|null

getLastStatus()

public getLastStatus() : string|null
Return values
string|null

getModuleId()

public getModuleId() : int|null
Return values
int|null

getOutbound()

public getOutbound() : bool
Return values
bool

getPath()

public getPath() : string
Return values
string

setAvailable()

public setAvailable(bool $available) : $this
Parameters
$available : bool
Return values
$this

setDefaultFrequency()

public setDefaultFrequency(string $defaultFrequency) : $this
Parameters
$defaultFrequency : string
Return values
$this

setEnabled()

public setEnabled(bool $enabled) : $this
Parameters
$enabled : bool
Return values
$this

setFrequency()

public setFrequency(string $frequency) : $this
Parameters
$frequency : string
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setLastDurationMs()

public setLastDurationMs(int|null $lastDurationMs) : $this
Parameters
$lastDurationMs : int|null
Return values
$this

setLastResponse()

public setLastResponse(string|null $lastResponse) : $this
Parameters
$lastResponse : string|null
Return values
$this

setLastRunTime()

public setLastRunTime(DateTime|null $lastRunTime) : $this
Parameters
$lastRunTime : DateTime|null
Return values
$this

setLastStatus()

public setLastStatus(string|null $lastStatus) : $this
Parameters
$lastStatus : string|null
Return values
$this

setModuleId()

public setModuleId(int|null $moduleId) : $this
Parameters
$moduleId : int|null
Return values
$this

setOutbound()

public setOutbound(bool $outbound) : $this
Parameters
$outbound : bool
Return values
$this

setPath()

public setPath(string $path) : $this
Parameters
$path : string
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results