6
6
use Flowpack \DecoupledContentStore \Core \Domain \ValueObject \ContentReleaseIdentifier ;
7
7
use Flowpack \DecoupledContentStore \Core \Domain \ValueObject \PrunnerJobId ;
8
8
use Flowpack \DecoupledContentStore \NodeRendering \Dto \NodeRenderingCompletionStatus ;
9
- use Neos \ContentRepository \Domain \Model \Workspace ;
10
9
use Neos \Flow \Annotations as Flow ;
11
10
12
11
/**
@@ -41,14 +40,17 @@ final class ContentReleaseMetadata implements \JsonSerializable
41
40
42
41
private ?string $ workspaceName ;
43
42
43
+ private ?string $ accountId ;
44
+
44
45
private function __construct (
45
46
PrunnerJobId $ prunnerJobId ,
46
47
?\DateTimeInterface $ startTime ,
47
48
?\DateTimeInterface $ endTime ,
48
49
?\DateTimeInterface $ switchTime ,
49
50
?NodeRenderingCompletionStatus $ status ,
50
51
?array $ manualTransferJobIds = [],
51
- string $ workspaceName = 'live '
52
+ string $ workspaceName = 'live ' ,
53
+ ?string $ accountId = 'cli '
52
54
)
53
55
{
54
56
$ this ->prunnerJobId = $ prunnerJobId ;
@@ -58,12 +60,13 @@ private function __construct(
58
60
$ this ->status = $ status ?: NodeRenderingCompletionStatus::scheduled ();
59
61
$ this ->manualTransferJobIds = $ manualTransferJobIds ;
60
62
$ this ->workspaceName = $ workspaceName ;
63
+ $ this ->accountId = $ accountId ;
61
64
}
62
65
63
66
64
- public static function create (PrunnerJobId $ prunnerJobId , \DateTimeInterface $ startTime , string $ workspace = 'live ' ): self
67
+ public static function create (PrunnerJobId $ prunnerJobId , \DateTimeInterface $ startTime , string $ workspace = 'live ' , string $ accountId = ' cli ' ): self
65
68
{
66
- return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled (), [], $ workspace );
69
+ return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled (), [], $ workspace, $ accountId );
67
70
}
68
71
69
72
public static function fromJsonString ($ metadataEncoded , ContentReleaseIdentifier $ contentReleaseIdentifier ): self
@@ -85,7 +88,8 @@ public static function fromJsonString($metadataEncoded, ContentReleaseIdentifier
85
88
isset ($ tmp ['manualTransferJobIds ' ]) ? array_map (function (string $ item ) {
86
89
return PrunnerJobId::fromString ($ item );
87
90
}, json_decode ($ tmp ['manualTransferJobIds ' ])) : [],
88
- $ tmp ['workspace ' ] ?? 'live '
91
+ $ tmp ['workspace ' ] ?? 'live ' ,
92
+ key_exists ('accountId ' , $ tmp ) ? $ tmp ['accountId ' ] : 'cli ' ,
89
93
);
90
94
}
91
95
@@ -99,30 +103,31 @@ public function jsonSerialize(): array
99
103
'switchTime ' => $ this ->switchTime ? $ this ->switchTime ->format (\DateTime::RFC3339_EXTENDED ) : null ,
100
104
'status ' => $ this ->status ,
101
105
'manualTransferJobIds ' => json_encode ($ this ->manualTransferJobIds ),
102
- 'workspaceName ' => $ this ->workspaceName
106
+ 'workspaceName ' => $ this ->workspaceName ,
107
+ 'accountId ' => $ this ->accountId ,
103
108
];
104
109
}
105
110
106
111
public function withEndTime (\DateTimeInterface $ endTime ): self
107
112
{
108
- return new self ($ this ->prunnerJobId , $ this ->startTime , $ endTime , $ this ->switchTime , $ this ->status , $ this ->manualTransferJobIds );
113
+ return new self ($ this ->prunnerJobId , $ this ->startTime , $ endTime , $ this ->switchTime , $ this ->status , $ this ->manualTransferJobIds , $ this -> workspaceName , $ this -> accountId );
109
114
}
110
115
111
116
public function withSwitchTime (\DateTimeInterface $ switchTime ): self
112
117
{
113
- return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ switchTime , $ this ->status , $ this ->manualTransferJobIds );
118
+ return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ switchTime , $ this ->status , $ this ->manualTransferJobIds , $ this -> workspaceName , $ this -> accountId );
114
119
}
115
120
116
121
public function withStatus (NodeRenderingCompletionStatus $ status ): self
117
122
{
118
- return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ this ->switchTime , $ status , $ this ->manualTransferJobIds );
123
+ return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ this ->switchTime , $ status , $ this ->manualTransferJobIds , $ this -> workspaceName , $ this -> accountId );
119
124
}
120
125
121
126
public function withAdditionalManualTransferJobId (PrunnerJobId $ prunnerJobId ): self
122
127
{
123
128
$ manualTransferIdArray = self ::getManualTransferJobIds ();
124
129
$ manualTransferIdArray [] = $ prunnerJobId ;
125
- return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ this ->switchTime , $ this ->status , $ manualTransferIdArray );
130
+ return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ this ->switchTime , $ this ->status , $ manualTransferIdArray, $ this -> workspaceName , $ this -> accountId );
126
131
}
127
132
128
133
public function getPrunnerJobId (): PrunnerJobId
@@ -163,4 +168,9 @@ public function getWorkspaceName(): ?string
163
168
return $ this ->workspaceName ;
164
169
}
165
170
171
+ public function getAccountId (): ?string
172
+ {
173
+ return $ this ->accountId ;
174
+ }
175
+
166
176
}
0 commit comments