public function rebaseAndRedirectAction(NodeInterface $targetNode, Workspace $targetWorkspace)
{
$currentAccount = $this->securityContext->getAccount();
$personalWorkspace = $this->workspaceRepository->findOneByName(UserUtility::getPersonalWorkspaceNameForUsername($currentAccount->getAccountIdentifier()));
/** @var Workspace $personalWorkspace */
if ($personalWorkspace !== $targetWorkspace) {
if ($this->publishingService->getUnpublishedNodesCount($personalWorkspace) > 0) {
$message = $this->translator->translateById('workspaces.cantEditBecauseWorkspaceContainsChanges', [], null, null, 'Modules', 'Neos.Neos');
$this->addFlashMessage($message, '', Message::SEVERITY_WARNING, [], 1437833387);
$this->redirect('show', null, null, ['workspace' => $targetWorkspace]);
}
$personalWorkspace->setBaseWorkspace($targetWorkspace);
$this->workspaceRepository->update($personalWorkspace);
}
$contextProperties = $targetNode->getContext()->getProperties();
$contextProperties['workspaceName'] = $personalWorkspace->getName();
$context = $this->contextFactory->create($contextProperties);
$mainRequest = $this->controllerContext->getRequest()->getMainRequest();
/** @var ActionRequest $mainRequest */
$this->uriBuilder->setRequest($mainRequest);
$this->redirect('show', 'Frontend\\Node', 'Neos.Neos', ['node' => $context->getNode($targetNode->getPath())]);
}