Skip to content
PHP Ecosystem
Explore

JobRecord

API reference › Debug Core › Panel › Queue › JobRecord

final readonly classPHPForge\Debug\Panel\Queue\JobRecord
ImplementsPHPForge\Debug\Storage\PanelRow
Sourcesrc/Panel/Queue/JobRecord.php

Typed view-model for a single queue lifecycle event captured during the request (push, exec, or error).

PropertyTypeDescriptionDefined by
$attempt readonly constructorint|nullCurrent attempt number for exec / error events (1 for the first run). null for push events.JobRecord
$componentId readonly constructorstringIdentifier of the queue component that emitted the event ('queue', 'queueEmail', …). '' when the sender could not be matched against any registered component.JobRecord
$delay readonly constructorint|nullDelay before execution declared at push time, in seconds. null when the driver default applies.JobRecord
$driverClass readonly constructorstringFully qualified class name of the queue driver that emitted the event. '' when the sender was not an object (defensive default).JobRecord
$driverName readonly constructorstringFriendly display name of the queue driver detected from the event sender’s class name ('Sync', 'Database', 'Redis', 'AMQP', 'Beanstalk', 'Gearman', or a custom-detected fallback).JobRecord
$duration readonly constructorfloat|nullExecution time in seconds for exec / error events. null for push events.JobRecord
$error readonly constructorstringCaptured exception message for error events. '' for push / exec events.JobRecord
$eventType readonly constructorstringLifecycle phase: 'push' (job enqueued), 'exec' (job finished successfully) or 'error' (job threw).JobRecord
$isAsync readonly constructorboolfalse when the driver runs jobs in-process during the same request (sync), true when jobs run in a separate worker (db, redis, amqp, beanstalk, gearman). The detail view uses this flag to show a hint about exec events living in CLI debug snapshots.JobRecord
$jobClass readonly constructorstringFully qualified class name of the job. '' when the event carried no job (defensive default).JobRecord
$jobId readonly constructorstringDriver-specific message id (the queue’s internal handle), or '' when the driver did not expose one.JobRecord
$payloadFields readonly constructorarray<string, mixed>Recursively normalised public-property tree of the job payload, captured at push time.JobRecord
$priority readonly constructorint|nullPriority override declared at push time. null when the driver default applies.JobRecord
$time readonly constructorfloatCapture timestamp in seconds since the Unix epoch (microseconds preserved as the fractional part).JobRecord
$ttr readonly constructorint|nullTime-to-run override declared at push time, in seconds. null when the driver default applies.JobRecord
MethodDescriptionDefined by
__construct()Creates a queue lifecycle event record.JobRecord
fromArray() staticNarrows one persisted event of the queue payload into a typed record.JobRecord
fromCapture() staticNarrows one captured queue-event payload into a typed record.JobRecord
jsonSerialize()Returns the typed row for JSON serialization.JobRecord
ConstantValueDescriptionDefined by
EVENT_TYPES[self::TYPE_PUSH, self::TYPE_EXEC, self::TYPE_ERROR]JobRecord
EVENT_VARIANTS[self::TYPE_PUSH => ['variant' => 'queued', 'label' => 'Queued'], self::TYPE_EXEC => ['variant' => 'done', 'label' => 'Done'], self::TYPE_ERROR => ['variant' => 'failed', 'label' => 'Failed']]JobRecord
TYPE_ERROR'error'Lifecycle phase value used when the job threw.JobRecord
TYPE_EXEC'exec'Lifecycle phase value used when the job finished successfully.JobRecord
TYPE_PUSH'push'Lifecycle phase value used when the job was enqueued.JobRecord
public readonly array<string, mixed> $payloadFields

Recursively normalised public-property tree of the job payload, captured at push time.

Scalars (string/int/float/bool/null) round-trip as-is; nested objects expand into nested arrays with a synthetic __class key carrying their FQCN. Empty when the event carried no job.

public function __construct(string $eventType, string $componentId, string $driverName, string $driverClass, bool $isAsync, string $jobClass, array $payloadFields, float $time, string $jobId, int|null $ttr, int|null $delay, int|null $priority, int|null $attempt, float|null $duration, string $error)

Creates a queue lifecycle event record.

Parameters

ParameterTypeDescription
$eventTypestring
$componentIdstring
$driverNamestring
$driverClassstring
$isAsyncbool
$jobClassstring
$payloadFieldsarray
$timefloat
$jobIdstring
$ttrint|null
$delayint|null
$priorityint|null
$attemptint|null
$durationfloat|null
$errorstring
public static function fromArray(mixed $data, string $path): self

Narrows one persisted event of the queue payload into a typed record.

Parameters

ParameterTypeDescription
$datamixedPersisted event, expected to be an object carrying the declared shape.
$pathstringJSON path of the event, used to report a malformed payload.

Returns

self: Record carrying every persisted event field.

Throws

public static function fromCapture(array<array-key, mixed> $row): self

Narrows one captured queue-event payload into a typed record.

Parameters

ParameterTypeDescription
$rowarray<array-key, mixed>Captured payload.

Returns

self

public function jsonSerialize(): array<string, mixed>

Returns the typed row for JSON serialization.

Returns

array<string, mixed>