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 ;
910use Neos \Flow \Annotations as Flow ;
1011
1112/**
@@ -38,20 +39,31 @@ final class ContentReleaseMetadata implements \JsonSerializable
3839
3940 private NodeRenderingCompletionStatus $ status ;
4041
41- private function __construct (PrunnerJobId $ prunnerJobId , ?\DateTimeInterface $ startTime , ?\DateTimeInterface $ endTime , ?\DateTimeInterface $ switchTime , ?NodeRenderingCompletionStatus $ status , ?array $ manualTransferJobIds = [])
42+ private ?string $ workspaceName ;
43+
44+ private function __construct (
45+ PrunnerJobId $ prunnerJobId ,
46+ ?\DateTimeInterface $ startTime ,
47+ ?\DateTimeInterface $ endTime ,
48+ ?\DateTimeInterface $ switchTime ,
49+ ?NodeRenderingCompletionStatus $ status ,
50+ ?array $ manualTransferJobIds = [],
51+ string $ workspaceName = 'live '
52+ )
4253 {
4354 $ this ->prunnerJobId = $ prunnerJobId ;
4455 $ this ->startTime = $ startTime ;
4556 $ this ->endTime = $ endTime ;
4657 $ this ->switchTime = $ switchTime ;
4758 $ this ->status = $ status ?: NodeRenderingCompletionStatus::scheduled ();
4859 $ this ->manualTransferJobIds = $ manualTransferJobIds ;
60+ $ this ->workspaceName = $ workspaceName ;
4961 }
5062
5163
52- public static function create (PrunnerJobId $ prunnerJobId , \DateTimeInterface $ startTime ): self
64+ public static function create (PrunnerJobId $ prunnerJobId , \DateTimeInterface $ startTime, string $ workspace = ' live ' ): self
5365 {
54- return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled ());
66+ return new self ($ prunnerJobId , $ startTime , null , null , NodeRenderingCompletionStatus::scheduled (), [], $ workspace );
5567 }
5668
5769 public static function fromJsonString ($ metadataEncoded , ContentReleaseIdentifier $ contentReleaseIdentifier ): self
@@ -72,20 +84,22 @@ public static function fromJsonString($metadataEncoded, ContentReleaseIdentifier
7284 NodeRenderingCompletionStatus::fromString ($ tmp ['status ' ]),
7385 isset ($ tmp ['manualTransferJobIds ' ]) ? array_map (function (string $ item ) {
7486 return PrunnerJobId::fromString ($ item );
75- }, json_decode ($ tmp ['manualTransferJobIds ' ])) : []
87+ }, json_decode ($ tmp ['manualTransferJobIds ' ])) : [],
88+ $ tmp ['workspace ' ] ?? 'live '
7689 );
7790 }
7891
7992
80- public function jsonSerialize ()
93+ public function jsonSerialize (): array
8194 {
8295 return [
8396 'prunnerJobId ' => $ this ->prunnerJobId ->getIdentifier (),
8497 'startTime ' => $ this ->startTime ? $ this ->startTime ->format (\DateTime::RFC3339_EXTENDED ) : null ,
8598 'endTime ' => $ this ->endTime ? $ this ->endTime ->format (\DateTime::RFC3339_EXTENDED ) : null ,
8699 'switchTime ' => $ this ->switchTime ? $ this ->switchTime ->format (\DateTime::RFC3339_EXTENDED ) : null ,
87100 'status ' => $ this ->status ,
88- 'manualTransferJobIds ' => json_encode ($ this ->manualTransferJobIds )
101+ 'manualTransferJobIds ' => json_encode ($ this ->manualTransferJobIds ),
102+ 'workspaceName ' => $ this ->workspaceName
89103 ];
90104 }
91105
@@ -111,41 +125,26 @@ public function withAdditionalManualTransferJobId(PrunnerJobId $prunnerJobId): s
111125 return new self ($ this ->prunnerJobId , $ this ->startTime , $ this ->endTime , $ this ->switchTime , $ this ->status , $ manualTransferIdArray );
112126 }
113127
114- /**
115- * @return PrunnerJobId
116- */
117128 public function getPrunnerJobId (): PrunnerJobId
118129 {
119130 return $ this ->prunnerJobId ;
120131 }
121132
122- /**
123- * @return \DateTimeInterface|null
124- */
125133 public function getStartTime (): ?\DateTimeInterface
126134 {
127135 return $ this ->startTime ;
128136 }
129137
130- /**
131- * @return \DateTimeInterface|null
132- */
133138 public function getEndTime (): ?\DateTimeInterface
134139 {
135140 return $ this ->endTime ;
136141 }
137142
138- /**
139- * @return \DateTimeInterface|null
140- */
141143 public function getSwitchTime (): ?\DateTimeInterface
142144 {
143145 return $ this ->switchTime ;
144146 }
145147
146- /**
147- * @return NodeRenderingCompletionStatus
148- */
149148 public function getStatus (): NodeRenderingCompletionStatus
150149 {
151150 return $ this ->status ;
@@ -159,4 +158,9 @@ public function getManualTransferJobIds(): ?array
159158 return $ this ->manualTransferJobIds ;
160159 }
161160
161+ public function getWorkspaceName (): ?string
162+ {
163+ return $ this ->workspaceName ;
164+ }
165+
162166}
0 commit comments