Retrieves the given node's corresponding node in the base workspace (that is, which would be overwritten if the
given node would be published)

@param NodeInterface $modifiedNode
@return NodeInterface
774671
protected function getOriginalNode(NodeInterface $modifiedNode)
    {
        $baseWorkspaceName = $modifiedNode->getWorkspace()->getBaseWorkspace()->getName();
        $contextProperties = $modifiedNode->getContext()->getProperties();
        $contextProperties['workspaceName'] = $baseWorkspaceName;
        $contentContext = $this->contextFactory->create($contextProperties);

        return $contentContext->getNodeByIdentifier($modifiedNode->getIdentifier());
    }
570990
public function removeNode(NodeInterface $node, string $targetWorkspaceName = null)
    {
        if ($this->settings['indexAllWorkspaces'] === false) {
            // we are only supposed to index the live workspace.
            // We need to check the workspace at two occasions; checking the
            // $targetWorkspaceName and the workspace name of the node's context as fallback
            if ($targetWorkspaceName !== null && $targetWorkspaceName !== 'live') {
                return;
            }

            if ($targetWorkspaceName === null && $node->getContext()->getWorkspaceName() !== 'live') {
                return;
            }
        }

        $documentIdentifier = $this->calculateDocumentIdentifier($node, $targetWorkspaceName);

        $this->currentBulkRequest[] = $this->documentDriver->delete($node, $documentIdentifier);
        $this->currentBulkRequest[] = $this->indexerDriver->fulltext($node, [], $targetWorkspaceName);

        $this->logger->log(sprintf('NodeIndexer (%s): Removed node %s (%s) from index.', $documentIdentifier, $node->getContextPath(), $node->getIdentifier()), LOG_DEBUG, null, 'ElasticSearch (CR)');
    }
1046148
public function getNodeCanonical(NodeInterface $node) : ?string
    {
        if ($this->isNodeBlacklisted($node)) {
            return null;
        }

        $site = null;
        $alias = null;

        if ($this->shareCanonicalAcrossSites) {
            $storage = $this->siteManager->getStorage();

            // Very fist site is the right one for canonical URL
            if ($node->site_id) {
                $site = $storage->findOne($node->site_id);
                if ($site->getState() !== SiteState::ON) {
                    $site = null;
                }
            }
        }

        // If no site, fetch on the current site
        if (!$site) {
            if ($this->siteManager->hasContext()) {
                $site = $this->siteManager->getContext();
            }
        }

        if ($site) {
            $alias = $this->aliasManager->getPathAlias($node->id(), $site->getId());
        }

        if (!$alias) {
            // No alias at all means that the canonical is the node URL in the
            // current site, I am sorry I can't provide more any magic here...
            return url('node/' . $node->id(), ['absolute' => true]);
        }

        return $this->siteManager->getUrlGenerator()->generateUrl($site, $alias, ['absolute' => true], true);
    }
1141454
public function createNewVersionNode(NodeInterface $originalNode, $versionName = '')
    {
        $status = $this->statusRepository->findOneByInitial();

        /** @var NodeInterface $newNode */
        $newNode = clone $originalNode;
        $newNode->setStatus($status);
        $newNode->setVersion($this->uniqueIdGenerator->generateUniqueId());
        $this->duplicateArea($originalNode, $newNode);

        $newNode->setVersionName($versionName);
        if (empty($versionName)) {
            $newNode = $this->setVersionName($newNode);
        }


        return $newNode;
    }
586655
public function storeDebugNode(NodeInterface $node)
    {
        $nodeId = count($this->debugNodes);
        $this->debugNodes[] = $node;

        return $nodeId;
    }
967292
public function nodePathAvailableForNode($nodePath, NodeInterface $node)
    {
        /** @var NodeData $existingNodeData */
        $existingNodeDataObjects = $this->nodeDataRepository->findByPathWithoutReduce($nodePath, $node->getWorkspace(), true);
        foreach ($existingNodeDataObjects as $existingNodeData) {
            if ($existingNodeData->getMovedTo() !== null && $existingNodeData->getMovedTo() === $node->getNodeData()) {
                return true;
            }
        }
        return !$this->nodePathExistsInAnyContext($nodePath);
    }
363512
public function node2Scope(SiteTreeNodeInterface $node){

        $scope = new TreeScope();
        $urlSegment = trim($node->getUrlSegment(),'/');

        $name = $urlSegment ? $urlSegment : TreeScope::DEFAULT_NAME;

        $scope->setPathPrefix($node->getUrlSegment());
        $scope->setName($name);
        $scope->setTitle($node->getMenuTitle());
        $scope->setModelRootId($node->{$this->treeModel->rootCol()});

        return $scope;

    }
29461
protected function getNode($nodeId)
    {
        $language = $this->siteManager->getSiteLanguage();
        $siteId = $this->siteManager->getSiteId();
        $node = $this->nodeRepository->findOnePublished($nodeId, $language, $siteId);

        if (!$node instanceof ReadNodeInterface) {
            throw new NodeNotFoundException();
        }

        return $node;
    }
1238352
public static function getRoot(NodeInterface $parent): ?PhpFileModelInterface
    {
        while ($parent !== null) {
            if ($parent instanceof PhpFileModelInterface) {
                return $parent;
            }
            $parent = $parent->getParentNode();
        }
        return null;
    }
728038
protected function createNode(NodeInterface $parent)
    {
        $nodeType = $this->getNodeType();
        $name = $this->getName() ?: $this->nodeService->generateUniqueNodeName($parent->getPath());

        $node = $parent->createNode($name, $nodeType);

        $this->applyNodeCreationHandlers($node);

        $this->finish($node);
        // NOTE: we need to run "finish" before "addNodeCreatedFeedback" to ensure the new node already exists when the last feedback is processed
        $this->addNodeCreatedFeedback($node);

        return $node;
    }
1012854
public function getNode(NodeRef $nodeRef): Node
    {
        if (!$this->hasNode($nodeRef)) {
            if ($this->lazyLoader->hasNodeRef($nodeRef)) {
                $this->lazyLoader->flush();
                if (!$this->hasNode($nodeRef)) {
                    throw NodeNotFound::forNodeRef($nodeRef);
                }
            } else {
                throw NodeNotFound::forNodeRef($nodeRef);
            }
        }

        $node = $this->nodes[$nodeRef->toString()];
        if ($node->isFrozen()) {
            $node = $this->nodes[$nodeRef->toString()] = clone $node;
        }

        return $node;
    }
1182788
public function publishNodeAction(NodeInterface $node, Workspace $selectedWorkspace)
    {
        $this->publishingService->publishNode($node);
        $this->addFlashMessage($this->translator->translateById('workspaces.selectedChangeHasBeenPublished', [], null, null, 'Modules', 'Neos.Neos'));
        $this->redirect('show', null, null, ['workspace' => $selectedWorkspace]);
    }
1031776
public function getNode(string $id): ServiceReferenceGraphNode
    {
        if (!isset($this->nodes[$id])) {
            throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id));
        }

        return $this->nodes[$id];
    }
208454
public static function getBranchesList(NodeInterface $node) {
    $branches_list = [
      'branch' => [],
      'camp' => [],
    ];

    if (!\Drupal::hasService('session_instance.manager')) {
      return $branches_list;
    }

    $locations = \Drupal::service('session_instance.manager')
      ->getLocationsByClassNode($node);
    foreach ($locations as $location) {
      if (!isset($branches_list[$location->bundle()][$location->id()])) {
        $branches_list[$location->bundle()][$location->id()] = $location->title->value;
      }
    }

    return $branches_list;
  }
269589
public function getNode(string $id): NodeInterface
    {
        if (!$this->hasNode($id)) {
            throw NodeDoesNotExistException::create($id);
        }

        return $this->_nodes[$id];
    }
1277078
public function getOrCreateProxyFromNode(NodeInterface $node, $locale = null)
    {
        $targetId = $node->getPath();
        $className = $this->documentClassMapper->getClassName($this->dm, $node);

        return $this->getOrCreateProxy($targetId, $className, $locale);
    }
915529
public static function getClosestAggregateNode(NodeInterface $node)
    {
        while ($node !== null && !$node->getNodeType()->isAggregate()) {
            $node = $node->getParent();
        }
        return $node;
    }