Neos.ContentRepository/Classes/Domain/Repository/NodeDataRepository.php
public function findOneByIdentifier($identifier, Workspace $workspace, array $dimensions = null, $removedNodes = false)
    {
        $workspaces = [];
        while ($workspace !== null) {
            /** @var $node NodeData */
            foreach ($this->addedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return $node;
                }
            }

            /** @var $node NodeData */
            foreach ($this->removedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return null;
                }
            }

            $workspaces[] = $workspace;
            $workspace = $workspace->getBaseWorkspace();
        }

        $queryBuilder = $this->createQueryBuilder($workspaces);
        if ($removedNodes === false) {
            $queryBuilder->andWhere('n.movedTo IS NULL OR n.removed = FALSE');
        } else {
            $queryBuilder->andWhere('n.movedTo IS NULL');
        }
        if ($dimensions !== null) {
            $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions);
        } else {
            $dimensions = [];
        }
        $this->addIdentifierConstraintToQueryBuilder($queryBuilder, $identifier);

        $query = $queryBuilder->getQuery();
        $nodes = $query->getResult();

        $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions);
        if ($removedNodes === false) {
            $foundNodes = $this->withoutRemovedNodes($foundNodes);
        }

        if ($foundNodes !== []) {
            return reset($foundNodes);
        }

        return null;
    }
public function findOneByIdentifier($identifier, Workspace $workspace, array $dimensions = null, $removedNodes = false)
    {
        $workspaces = [];
        while ($workspace !== null) {
            /** @var $node NodeData */
            foreach ($this->addedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return $node;
                }
            }

            /** @var $node NodeData */
            foreach ($this->removedNodes as $node) {
                if ($node->getIdentifier() === $identifier && $node->matchesWorkspaceAndDimensions($workspace, $dimensions)) {
                    return null;
                }
            }

            $workspaces[] = $workspace;
            $workspace = $workspace->getBaseWorkspace();
        }

        $queryBuilder = $this->createQueryBuilder($workspaces);
        if ($removedNodes === false) {
            $queryBuilder->andWhere('n.movedTo IS NULL OR n.removed = FALSE');
        } else {
            $queryBuilder->andWhere('n.movedTo IS NULL');
        }
        if ($dimensions !== null) {
            $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions);
        } else {
            $dimensions = [];
        }
        $this->addIdentifierConstraintToQueryBuilder($queryBuilder, $identifier);

        $query = $queryBuilder->getQuery();
        $nodes = $query->getResult();

        $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions);
        if ($removedNodes === false) {
            $foundNodes = $this->withoutRemovedNodes($foundNodes);
        }

        if ($foundNodes !== []) {
            return reset($foundNodes);
        }

        return null;
    }
public function findOneByIdentifier ( $ identifier , Workspace $ workspace , array $ dimensions = null , $ removedNodes = false ) { $ workspaces = [ ] ; while ( $ workspace !== null ) { /** @var $node NodeData */ foreach ( $ this -> addedNodes as $ node ) { if ( $ node -> getIdentifier ( ) === $ identifier && $ node -> matchesWorkspaceAndDimensions ( $ workspace , $ dimensions ) ) { return $ node ; } } /** @var $node NodeData */ foreach ( $ this -> removedNodes as $ node ) { if ( $ node -> getIdentifier ( ) === $ identifier && $ node -> matchesWorkspaceAndDimensions ( $ workspace , $ dimensions ) ) { return null ; } } $ workspaces [ ] = $ workspace ; $ workspace = $ workspace -> getBaseWorkspace ( ) ; } $ queryBuilder = $ this -> createQueryBuilder ( $ workspaces ) ; if ( $ removedNodes === false ) { $ queryBuilder -> andWhere ( 'n.movedTo IS NULL OR n.removed = FALSE' ) ; } else { $ queryBuilder -> andWhere ( 'n.movedTo IS NULL' ) ; } if ( $ dimensions !== null ) { $ this -> addDimensionJoinConstraintsToQueryBuilder ( $ queryBuilder , $ dimensions ) ; } else { $ dimensions = [ ] ; } $ this -> addIdentifierConstraintToQueryBuilder ( $ queryBuilder , $ identifier ) ; $ query = $ queryBuilder -> getQuery ( ) ; $ nodes = $ query -> getResult ( ) ; $ foundNodes = $ this -> reduceNodeVariantsByWorkspacesAndDimensions ( $ nodes , $ workspaces , $ dimensions ) ; if ( $ removedNodes === false ) { $ foundNodes = $ this -> withoutRemovedNodes ( $ foundNodes ) ; } if ( $ foundNodes !== [ ] ) { return reset ( $ foundNodes ) ; } return null ; }
Finds a node by its identifier and workspace.

If the node does not exist in the specified workspace, this function will
try to find one with the given identifier in one of the base workspaces (if any).

@param string $identifier Identifier of the node
@param Workspace $workspace The containing workspace
@param array $dimensions An array of dimensions with array of ordered values to use for fallback matching
@param bool $removedNodes If shadow nodes should be considered while finding the specified node
@return NodeData The matching node if found, otherwise NULL
Finds a node by its identifier and workspace .