workflowId = $workflowId; $this->triggerKey = $triggerKey; $now = new DateTimeImmutable(); $this->createdAt = $now; $this->updatedAt = $now; } public function getId(): int { return $this->id; } public function getWorkflowId(): int { return $this->workflowId; } public function getTriggerKey(): string { return $this->triggerKey; } public function getStatus(): string { return $this->status; } public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): DateTimeImmutable { return $this->updatedAt; } public function toArray(): array { return [ 'workflow_id' => $this->workflowId, 'trigger_key' => $this->triggerKey, 'status' => $this->status, 'created_at' => $this->createdAt->format(DateTimeImmutable::W3C), 'updated_at' => $this->updatedAt->format(DateTimeImmutable::W3C), ]; } public static function fromArray(array $data): self { $workflowRun = new WorkflowRun((int)$data['workflow_id'], $data['trigger_key']); $workflowRun->id = (int)$data['id']; $workflowRun->status = $data['status']; $workflowRun->createdAt = $data['created_at']; $workflowRun->createdAt = $data['updated_at']; return $workflowRun; } }