Neos\Neos\Command\NodeCommandControllerPlugin::removeContentDimensionsFromRootAndSitesNode PHP Method

removeContentDimensionsFromRootAndSitesNode() public method

This empties the content dimensions on those nodes, so when traversing via the Node API from the root node, the nodes below "/sites" are always reachable.
public removeContentDimensionsFromRootAndSitesNode ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string
$dryRun boolean
return void
    public function removeContentDimensionsFromRootAndSitesNode($workspaceName, $dryRun)
    {
        $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
        $rootNodes = $this->nodeDataRepository->findByPath('/', $workspace);
        $sitesNodes = $this->nodeDataRepository->findByPath('/sites', $workspace);
        $this->output->outputLine('Checking for root and site nodes with content dimensions set ...');
        /** @var \Neos\ContentRepository\Domain\Model\NodeData $rootNode */
        foreach ($rootNodes as $rootNode) {
            if ($rootNode->getDimensionValues() !== []) {
                if ($dryRun === false) {
                    $rootNode->setDimensions([]);
                    $this->nodeDataRepository->update($rootNode);
                    $this->output->outputLine('Removed content dimensions from root node');
                } else {
                    $this->output->outputLine('Found root node with content dimensions set.');
                }
            }
        }
        /** @var \Neos\ContentRepository\Domain\Model\NodeData $sitesNode */
        foreach ($sitesNodes as $sitesNode) {
            if ($sitesNode->getDimensionValues() !== []) {
                if ($dryRun === false) {
                    $sitesNode->setDimensions([]);
                    $this->nodeDataRepository->update($sitesNode);
                    $this->output->outputLine('Removed content dimensions from node "/sites"');
                } else {
                    $this->output->outputLine('Found node "/sites"');
                }
            }
        }
    }