|
@@ 170-198 (lines=29) @@
|
| 167 |
|
return $locations; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
public function createContentDraft( |
| 171 |
|
ContentInfo $contentInfo, |
| 172 |
|
VersionInfo $versionInfo = null, |
| 173 |
|
User $creator = null |
| 174 |
|
): Content { |
| 175 |
|
$eventData = [ |
| 176 |
|
$contentInfo, |
| 177 |
|
$versionInfo, |
| 178 |
|
$creator, |
| 179 |
|
]; |
| 180 |
|
|
| 181 |
|
$beforeEvent = new BeforeCreateContentDraftEvent(...$eventData); |
| 182 |
|
|
| 183 |
|
$this->eventDispatcher->dispatch($beforeEvent, BeforeCreateContentDraftEventInterface::class); |
| 184 |
|
if ($beforeEvent->isPropagationStopped()) { |
| 185 |
|
return $beforeEvent->getContentDraft(); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
$contentDraft = $beforeEvent->hasContentDraft() |
| 189 |
|
? $beforeEvent->getContentDraft() |
| 190 |
|
: $this->innerService->createContentDraft($contentInfo, $versionInfo, $creator); |
| 191 |
|
|
| 192 |
|
$this->eventDispatcher->dispatch( |
| 193 |
|
new CreateContentDraftEvent($contentDraft, ...$eventData), |
| 194 |
|
CreateContentDraftEventInterface::class |
| 195 |
|
); |
| 196 |
|
|
| 197 |
|
return $contentDraft; |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
public function updateContent( |
| 201 |
|
VersionInfo $versionInfo, |
|
@@ 273-301 (lines=29) @@
|
| 270 |
|
); |
| 271 |
|
} |
| 272 |
|
|
| 273 |
|
public function copyContent( |
| 274 |
|
ContentInfo $contentInfo, |
| 275 |
|
LocationCreateStruct $destinationLocationCreateStruct, |
| 276 |
|
VersionInfo $versionInfo = null |
| 277 |
|
): Content { |
| 278 |
|
$eventData = [ |
| 279 |
|
$contentInfo, |
| 280 |
|
$destinationLocationCreateStruct, |
| 281 |
|
$versionInfo, |
| 282 |
|
]; |
| 283 |
|
|
| 284 |
|
$beforeEvent = new BeforeCopyContentEvent(...$eventData); |
| 285 |
|
|
| 286 |
|
$this->eventDispatcher->dispatch($beforeEvent, BeforeCopyContentEventInterface::class); |
| 287 |
|
if ($beforeEvent->isPropagationStopped()) { |
| 288 |
|
return $beforeEvent->getContent(); |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
$content = $beforeEvent->hasContent() |
| 292 |
|
? $beforeEvent->getContent() |
| 293 |
|
: $this->innerService->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo); |
| 294 |
|
|
| 295 |
|
$this->eventDispatcher->dispatch( |
| 296 |
|
new CopyContentEvent($content, ...$eventData), |
| 297 |
|
CopyContentEventInterface::class |
| 298 |
|
); |
| 299 |
|
|
| 300 |
|
return $content; |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
public function addRelation( |
| 304 |
|
VersionInfo $sourceVersion, |