src/Sulu/Bundle/PageBundle/Repository/NodeRepository.php
private function iterateTiers($tiers, &$result)
    {
        reset($tiers);
        $uuid = key($tiers);
        $tier = array_shift($tiers);

        $found = false;
        if (is_array($result)) {
            foreach ($result as &$node) {
                if ($node['id'] === $uuid) {
                    $node['_embedded']['nodes'] = $tier;
                    $found = true;
                    break;
                }
            }
        }

        if (!$tiers) {
            return;
        }

        if (!$found) {
            throw new \RuntimeException(
                sprintf(
                    'Could not find target node in with UUID "%s" in tier. This should not happen.',
                    $uuid
                )
            );
        }

        $this->iterateTiers($tiers, $node['_embedded']['nodes']);
    }
private function iterateTiers($tiers, &$result)
    {
        reset($tiers);
        $uuid = key($tiers);
        $tier = array_shift($tiers);

        $found = false;
        if (is_array($result)) {
            foreach ($result as &$node) {
                if ($node['id'] === $uuid) {
                    $node['_embedded']['nodes'] = $tier;
                    $found = true;
                    break;
                }
            }
        }

        if (!$tiers) {
            return;
        }

        if (!$found) {
            throw new \RuntimeException(
                sprintf(
                    'Could not find target node in with UUID "%s" in tier. This should not happen.',
                    $uuid
                )
            );
        }

        $this->iterateTiers($tiers, $node['_embedded']['nodes']);
    }
private function iterateTiers ( $ tiers , & $ result ) { reset ( $ tiers ) ; $ uuid = key ( $ tiers ) ; $ tier = array_shift ( $ tiers ) ; $ found = false ; if ( is_array ( $ result ) ) { foreach ( $ result as & $ node ) { if ( $ node [ 'id' ] === $ uuid ) { $ node [ '_embedded' ] [ 'nodes' ] = $ tier ; $ found = true ; break ; } } } if ( ! $ tiers ) { return ; } if ( ! $ found ) { throw new \ RuntimeException ( sprintf ( 'Could not find target node in with UUID "%s" in tier. This should not happen.' , $ uuid ) ) ; } $ this -> iterateTiers ( $ tiers , $ node [ '_embedded' ] [ 'nodes' ] ) ; }
Iterate over the ancestor tiers and build up the result.

@param array $tiers
@param array $result (by rereference)
Iterate over the ancestor tiers and build up the result .