Add version_id to WorkflowRun

[MAILPOET-4430]
This commit is contained in:
David Remer
2022-08-03 09:02:33 +03:00
committed by Veljko V
parent 456417a467
commit 02489a61a6
4 changed files with 19 additions and 8 deletions

View File

@ -20,6 +20,9 @@ class WorkflowRun {
/** @var int */
private $workflowId;
/** @var int */
private $versionId;
/** @var string */
private $triggerKey;
@ -43,11 +46,13 @@ class WorkflowRun {
*/
public function __construct(
int $workflowId,
int $versionId,
string $triggerKey,
array $subjects,
int $id = null
) {
$this->workflowId = $workflowId;
$this->versionId = $versionId;
$this->triggerKey = $triggerKey;
$this->subjects = $subjects;
@ -72,6 +77,10 @@ class WorkflowRun {
return $this->workflowId;
}
public function getVersionId(): int {
return $this->workflowId;
}
public function getTriggerKey(): string {
return $this->triggerKey;
}
@ -130,6 +139,7 @@ class WorkflowRun {
public function toArray(): array {
return [
'workflow_id' => $this->workflowId,
'version_id' => $this->versionId,
'trigger_key' => $this->triggerKey,
'status' => $this->status,
'created_at' => $this->createdAt->format(DateTimeImmutable::W3C),
@ -143,7 +153,7 @@ class WorkflowRun {
}
public static function fromArray(array $data): self {
$workflowRun = new WorkflowRun((int)$data['workflow_id'], $data['trigger_key'], $data['subjects']);
$workflowRun = new WorkflowRun((int)$data['workflow_id'], (int)$data['version_id'], $data['trigger_key'], $data['subjects']);
$workflowRun->id = (int)$data['id'];
$workflowRun->status = $data['status'];
$workflowRun->createdAt = $data['created_at'];