Neos.Neos/Classes/Service/BackendRedirectionService.php
protected function createWorkspaceAndRootNodeIfNecessary($workspaceName)
    {
        $workspace = $this->workspaceRepository->findOneByName($workspaceName);
        if ($workspace === null) {
            $liveWorkspace = $this->workspaceRepository->findOneByName('live');
            $owner = $this->userService->getBackendUser();
            $workspace = new Workspace($workspaceName, $liveWorkspace, $owner);
            $this->workspaceRepository->add($workspace);
            $this->persistenceManager->whitelistObject($workspace);
        }

        $contentContext = $this->createContext($workspaceName);
        $rootNode = $contentContext->getRootNode();
        $this->persistenceManager->whitelistObject($rootNode);
        $this->persistenceManager->whitelistObject($rootNode->getNodeData());
        $this->persistenceManager->persistAll(true);
    }
protected function createWorkspaceAndRootNodeIfNecessary($workspaceName)
    {
        $workspace = $this->workspaceRepository->findOneByName($workspaceName);
        if ($workspace === null) {
            $liveWorkspace = $this->workspaceRepository->findOneByName('live');
            $owner = $this->userService->getBackendUser();
            $workspace = new Workspace($workspaceName, $liveWorkspace, $owner);
            $this->workspaceRepository->add($workspace);
            $this->persistenceManager->whitelistObject($workspace);
        }

        $contentContext = $this->createContext($workspaceName);
        $rootNode = $contentContext->getRootNode();
        $this->persistenceManager->whitelistObject($rootNode);
        $this->persistenceManager->whitelistObject($rootNode->getNodeData());
        $this->persistenceManager->persistAll(true);
    }
protected function createWorkspaceAndRootNodeIfNecessary ( $ workspaceName ) { $ workspace = $ this -> workspaceRepository -> findOneByName ( $ workspaceName ) ; if ( $ workspace === null ) { $ liveWorkspace = $ this -> workspaceRepository -> findOneByName ( 'live' ) ; $ owner = $ this -> userService -> getBackendUser ( ) ; $ workspace = new Workspace ( $ workspaceName , $ liveWorkspace , $ owner ) ; $ this -> workspaceRepository -> add ( $ workspace ) ; $ this -> persistenceManager -> whitelistObject ( $ workspace ) ; } $ contentContext = $ this -> createContext ( $ workspaceName ) ; $ rootNode = $ contentContext -> getRootNode ( ) ; $ this -> persistenceManager -> whitelistObject ( $ rootNode ) ; $ this -> persistenceManager -> whitelistObject ( $ rootNode -> getNodeData ( ) ) ; $ this -> persistenceManager -> persistAll ( true ) ; }
If the specified workspace or its root node does not exist yet, the workspace and root node will be created.

This method is basically a safeguard for legacy and potentially broken websites where users might not have
their own workspace yet. In a normal setup, the Domain User Service is responsible for creating and deleting
user workspaces.

@param string $workspaceName Name of the workspace
@return void
If the specified workspace or its root node does not exist yet the workspace and root node will be created .