From 7b75c2b7a66d90a5eafeadd430cf74e6e18d3e7a Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Fri, 16 Aug 2024 09:13:16 +0200 Subject: [PATCH] BUGFIX: Remove rootnode when user workspace is deleted Fixes: #2193 --- Neos.Neos/Classes/Domain/Service/UserService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Neos.Neos/Classes/Domain/Service/UserService.php b/Neos.Neos/Classes/Domain/Service/UserService.php index f538ec08c66..0a07baf2a9b 100644 --- a/Neos.Neos/Classes/Domain/Service/UserService.php +++ b/Neos.Neos/Classes/Domain/Service/UserService.php @@ -902,8 +902,13 @@ protected function deletePersonalWorkspace($accountIdentifier) { $userWorkspace = $this->workspaceRepository->findByIdentifier(UserUtility::getPersonalWorkspaceNameForUsername($accountIdentifier)); if ($userWorkspace instanceof Workspace) { + $rootNode = $userWorkspace->getRootNodeData(); $this->publishingService->discardAllNodes($userWorkspace); $this->workspaceRepository->remove($userWorkspace); + + // Persist removal of workspace so we can remove the root node without a foreign key constraint violation + $this->persistenceManager->persistAll(); + $rootNode->remove(); } }