Jackalope\Property::getReferencedNodes PHP Method

getReferencedNodes() private method

Get all nodes for $ids, ordered by that array, with duplicates if there are duplicates in $ids.
private getReferencedNodes ( string[] $ids, boolean $weak ) : Node[]
$ids string[] List of ids to fetch.
$weak boolean Whether these are weak references, to throw the right exception.
return Node[]
    private function getReferencedNodes($ids, $weak)
    {
        $results = array();
        $nodes = $this->objectManager->getNodesByIdentifier($ids);
        $missing = array();
        foreach ($ids as $id) {
            if (isset($nodes[$id])) {
                $results[] = $nodes[$id];
            } else {
                $missing[$id] = $id;
            }
        }
        if (count($missing)) {
            if ($weak) {
                throw new ItemNotFoundException(sprintf('One or more weak reference targets have not been found: "%s".', implode('", "', $missing)));
            } else {
                throw new RepositoryException(sprintf('Internal Error: Could not find one or more referenced nodes: "%s". ' . 'If the referencing node is a frozen version, this can happen, otherwise it would be a bug.', implode('", "', $missing)));
            }
        }
        return $results;
    }