Neos\Neos\Command\WorkspaceCommandController::rebaseCommand PHP Method

rebaseCommand() public method

This command sets a new base workspace for the specified workspace. Note that doing so will put the possible changes contained in the workspace to be rebased into a different context and thus might lead to unintended results when being published.
public rebaseCommand ( string $workspace, string $baseWorkspace ) : void
$workspace string Name of the workspace to rebase, for example "user-john"
$baseWorkspace string Name of the new base workspace
return void
    public function rebaseCommand($workspace, $baseWorkspace)
    {
        $workspaceName = $workspace;
        $workspace = $this->workspaceRepository->findOneByName($workspaceName);
        if (!$workspace instanceof Workspace) {
            $this->outputLine('Workspace "%s" does not exist', [$workspaceName]);
            $this->quit(1);
        }
        $baseWorkspaceName = $baseWorkspace;
        $baseWorkspace = $this->workspaceRepository->findOneByName($baseWorkspaceName);
        if (!$baseWorkspace instanceof Workspace) {
            $this->outputLine('The base workspace "%s" does not exist', [$baseWorkspaceName]);
            $this->quit(2);
        }
        $workspace->setBaseWorkspace($baseWorkspace);
        $this->workspaceRepository->update($workspace);
        $this->outputLine('Set "%s" as the new base workspace for "%s".', [$baseWorkspaceName, $workspaceName]);
    }