diff --git a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php index 53a5c282b5c..0763a5dcade 100644 --- a/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php +++ b/Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php @@ -65,6 +65,10 @@ public function getContentGraph(WorkspaceName $workspaceName): ContentGraphInter return $this->overridenContentGraphInstances[$workspaceName->value]; } + if ($workspaceName->isReferencingUnusedContentStream()) { + throw new \RuntimeException(sprintf('Expected actual workspace name. Got a workspace name referencing an unused content stream: "%s" instead.', $workspaceName->getReferencingUnusedContentStreamId()->value), 1719648458); + } + return $this->contentRepository->getContentGraph($workspaceName); } diff --git a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php index 1e96149f95f..1a03137b377 100644 --- a/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php +++ b/Neos.ContentRepository.Core/Classes/Feature/WorkspaceCommandHandler.php @@ -900,6 +900,10 @@ private function handleChangeWorkspaceOwner( private function requireWorkspaceToNotExist(WorkspaceName $workspaceName, CommandHandlingDependencies $commandHandlingDependencies): void { + if ($workspaceName->isReferencingUnusedContentStream()) { + throw new \RuntimeException(sprintf('Expected actual workspace name. Got a workspace name referencing an unused content stream: "%s" instead.', $workspaceName->getReferencingUnusedContentStreamId()->value), 1719648458); + } + try { $commandHandlingDependencies->getContentGraph($workspaceName); } catch (WorkspaceDoesNotExist) { @@ -918,6 +922,10 @@ private function requireWorkspaceToNotExist(WorkspaceName $workspaceName, Comman */ private function requireWorkspace(WorkspaceName $workspaceName, WorkspaceFinder $workspaceFinder): Workspace { + if ($workspaceName->isReferencingUnusedContentStream()) { + throw new \RuntimeException(sprintf('Expected actual workspace name. Got a workspace name referencing an unused content stream: "%s" instead.', $workspaceName->getReferencingUnusedContentStreamId()->value), 1719648458); + } + $workspace = $workspaceFinder->findOneByName($workspaceName); if (is_null($workspace)) { throw WorkspaceDoesNotExist::butWasSupposedTo($workspaceName);