Skip to content

Commit

Permalink
Merge pull request #3875 from kdambekalns/bugfix/handle-publishing-nu…
Browse files Browse the repository at this point in the history
…ll-nodes

BUGFIX: Skip `null` when publishing nodes
  • Loading branch information
skurfuerst authored Oct 23, 2024
2 parents 288e29a + 139cfee commit a5b7015
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,18 @@ protected function updateWorkspaceInfo(string $documentNodeContextPath): void
{
$updateWorkspaceInfo = new UpdateWorkspaceInfo();
$documentNode = $this->nodeService->getNodeFromContextPath($documentNodeContextPath, null, null, true);
$updateWorkspaceInfo->setWorkspace(
$documentNode->getContext()->getWorkspace()
);
if ($documentNode === null) {
$error = new Error();
$error->setMessage(sprintf('Could not find node for document node context path "%s"', $documentNodeContextPath));

$this->feedbackCollection->add($error);
} else {
$updateWorkspaceInfo->setWorkspace(
$documentNode->getContext()->getWorkspace()
);

$this->feedbackCollection->add($updateWorkspaceInfo);
$this->feedbackCollection->add($updateWorkspaceInfo);
}
}

/**
Expand Down Expand Up @@ -237,6 +244,14 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa

foreach ($nodeContextPaths as $contextPath) {
$node = $this->nodeService->getNodeFromContextPath($contextPath, null, null, true);
if ($node === null) {
$error = new Info();
$error->setMessage(sprintf('Could not find node for context path "%s"', $contextPath));

$this->feedbackCollection->add($error);

continue;
}
$this->publishingService->publishNode($node, $targetWorkspace);

if ($node->getNodeType()->isAggregate()) {
Expand Down

0 comments on commit a5b7015

Please sign in to comment.