66use Flowpack \DecoupledContentStore \Core \Domain \ValueObject \ContentReleaseIdentifier ;
77use Flowpack \DecoupledContentStore \Core \Domain \ValueObject \PrunnerJobId ;
88use Flowpack \DecoupledContentStore \NodeRendering \Dto \NodeRenderingCompletionStatus ;
9- use Neos \ContentRepository \Domain \Model \Workspace ;
109use Neos \Flow \Annotations as Flow ;
1110
1211/**
@@ -41,14 +40,17 @@ final class ContentReleaseMetadata implements \JsonSerializable
4140
4241 private ?string $ workspaceName ;
4342
43+ private ?string $ accountId ;
44+
4445 private function __construct (
4546 PrunnerJobId $ prunnerJobId ,
4647 ?\DateTimeInterface $ startTime ,
4748 ?\DateTimeInterface $ endTime ,
4849 ?\DateTimeInterface $ switchTime ,
4950 ?NodeRenderingCompletionStatus $ status ,
5051 ?array $ manualTransferJobIds = [],
51- string $ workspaceName = 'live '
52+ string $ workspaceName = 'live ' ,
53+ ?string $ accountId = 'cli '
5254 )
5355 {
5456 $ this ->prunnerJobId = $ prunnerJobId ;
@@ -58,12 +60,13 @@ private function __construct(
5860 $ this ->status = $ status ?: NodeRenderingCompletionStatus::scheduled ();
5961 $ this ->manualTransferJobIds = $ manualTransferJobIds ;
6062 $ this ->workspaceName = $ workspaceName ;
63+ $ this ->accountId = $ accountId ;
6164 }
6265
6366
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
6568 {
66- return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled (), [], $ workspace );
69+ return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled (), [], $ workspace, $ accountId );
6770 }
6871
6972 public static function fromJsonString ($ metadataEncoded , ContentReleaseIdentifier $ contentReleaseIdentifier ): self
@@ -85,7 +88,8 @@ public static function fromJsonString($metadataEncoded, ContentReleaseIdentifier
8588 isset ($ tmp ['manualTransferJobIds ' ]) ? array_map (function (string $ item ) {
8689 return PrunnerJobId::fromString ($ item );
8790 }, json_decode ($ tmp ['manualTransferJobIds ' ])) : [],
88- $ tmp ['workspace ' ] ?? 'live '
91+ $ tmp ['workspace ' ] ?? 'live ' ,
92+ key_exists ('accountId ' , $ tmp ) ? $ tmp ['accountId ' ] : 'cli ' ,
8993 );
9094 }
9195
@@ -99,30 +103,31 @@ public function jsonSerialize(): array
99103 'switchTime ' => $ this ->switchTime ? $ this ->switchTime ->format (\DateTime::RFC3339_EXTENDED ) : null ,
100104 'status ' => $ this ->status ,
101105 'manualTransferJobIds ' => json_encode ($ this ->manualTransferJobIds ),
102- 'workspaceName ' => $ this ->workspaceName
106+ 'workspaceName ' => $ this ->workspaceName ,
107+ 'accountId ' => $ this ->accountId ,
103108 ];
104109 }
105110
106111 public function withEndTime (\DateTimeInterface $ endTime ): self
107112 {
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 );
109114 }
110115
111116 public function withSwitchTime (\DateTimeInterface $ switchTime ): self
112117 {
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 );
114119 }
115120
116121 public function withStatus (NodeRenderingCompletionStatus $ status ): self
117122 {
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 );
119124 }
120125
121126 public function withAdditionalManualTransferJobId (PrunnerJobId $ prunnerJobId ): self
122127 {
123128 $ manualTransferIdArray = self ::getManualTransferJobIds ();
124129 $ 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 );
126131 }
127132
128133 public function getPrunnerJobId (): PrunnerJobId
@@ -163,4 +168,9 @@ public function getWorkspaceName(): ?string
163168 return $ this ->workspaceName ;
164169 }
165170
171+ public function getAccountId (): ?string
172+ {
173+ return $ this ->accountId ;
174+ }
175+
166176}
0 commit comments