src/Sulu/Bundle/PageBundle/Controller/NodeController.php
private function getTreeContent(
        $id,
        $locale,
        $webspaceKey,
        $webspaceNodes,
        MappingInterface $mapping,
        UserInterface $user
    ) {
        if (!in_array($webspaceNodes, [static::WEBSPACE_NODE_SINGLE, static::WEBSPACE_NODES_ALL, null])) {
            throw new ParameterDataTypeException(get_class($this), 'webspace-nodes');
        }

        try {
            $contents = $this->get('sulu_page.content_repository')->findParentsWithSiblingsByUuid(
                $id,
                $locale,
                $webspaceKey,
                $mapping,
                $user
            );
        } catch (ItemNotFoundException $e) {
            throw new EntityNotFoundException('node', $id, $e);
        }

        if ($webspaceNodes === static::WEBSPACE_NODES_ALL) {
            $contents = $this->getWebspaceNodes($mapping, $contents, $locale, $user);
        } elseif ($webspaceNodes === static::WEBSPACE_NODE_SINGLE) {
            $contents = $this->getWebspaceNode($mapping, $contents, $webspaceKey, $locale, $user);
        }

        $view = $this->view(new CollectionRepresentation($contents, static::$relationName));

        return $this->handleView($view);
    }
private function getTreeContent(
        $id,
        $locale,
        $webspaceKey,
        $webspaceNodes,
        MappingInterface $mapping,
        UserInterface $user
    ) {
        if (!in_array($webspaceNodes, [static::WEBSPACE_NODE_SINGLE, static::WEBSPACE_NODES_ALL, null])) {
            throw new ParameterDataTypeException(get_class($this), 'webspace-nodes');
        }

        try {
            $contents = $this->get('sulu_page.content_repository')->findParentsWithSiblingsByUuid(
                $id,
                $locale,
                $webspaceKey,
                $mapping,
                $user
            );
        } catch (ItemNotFoundException $e) {
            throw new EntityNotFoundException('node', $id, $e);
        }

        if ($webspaceNodes === static::WEBSPACE_NODES_ALL) {
            $contents = $this->getWebspaceNodes($mapping, $contents, $locale, $user);
        } elseif ($webspaceNodes === static::WEBSPACE_NODE_SINGLE) {
            $contents = $this->getWebspaceNode($mapping, $contents, $webspaceKey, $locale, $user);
        }

        $view = $this->view(new CollectionRepresentation($contents, static::$relationName));

        return $this->handleView($view);
    }
private function getTreeContent ( $ id , $ locale , $ webspaceKey , $ webspaceNodes , MappingInterface $ mapping , UserInterface $ user ) { if ( ! in_array ( $ webspaceNodes , [ static :: WEBSPACE_NODE_SINGLE , static :: WEBSPACE_NODES_ALL , null ] ) ) { throw new ParameterDataTypeException ( get_class ( $ this ) , 'webspace-nodes' ) ; } try { $ contents = $ this -> get ( 'sulu_page.content_repository' ) -> findParentsWithSiblingsByUuid ( $ id , $ locale , $ webspaceKey , $ mapping , $ user ) ; } catch ( ItemNotFoundException $ e ) { throw new EntityNotFoundException ( 'node' , $ id , $ e ) ; } if ( $ webspaceNodes === static :: WEBSPACE_NODES_ALL ) { $ contents = $ this -> getWebspaceNodes ( $ mapping , $ contents , $ locale , $ user ) ; } elseif ( $ webspaceNodes === static :: WEBSPACE_NODE_SINGLE ) { $ contents = $ this -> getWebspaceNode ( $ mapping , $ contents , $ webspaceKey , $ locale , $ user ) ; } $ view = $ this -> view ( new CollectionRepresentation ( $ contents , static :: $ relationName ) ) ; return $ this -> handleView ( $ view ) ; }
Returns tree response for given id.

@param string $id
@param string $locale
@param string $webspaceKey
@param bool $webspaceNodes
@param MappingInterface $mapping
@param UserInterface $user

@return Response

@throws ParameterDataTypeException
@throws EntityNotFoundException
Returns tree response for given id .