src/Sulu/Bundle/PageBundle/Controller/NodeController.php
private function getContent(Request $request, $id)
    {
        $properties = array_filter(explode(',', $request->get('fields', '')));
        $excludeGhosts = $this->getBooleanRequestParameter($request, 'exclude-ghosts', false, false);
        $excludeShadows = $this->getBooleanRequestParameter($request, 'exclude-shadows', false, false);
        $webspaceNodes = $this->getRequestParameter($request, 'webspace-nodes');
        $locale = $this->getRequestParameter($request, 'language', true);
        $webspaceKey = $this->getRequestParameter($request, 'webspace');

        $user = $this->getUser();

        $mapping = MappingBuilder::create()
            ->setHydrateGhost(!$excludeGhosts)
            ->setHydrateShadow(!$excludeShadows)
            ->setResolveConcreteLocales(true)
            ->addProperties($properties)
            ->getMapping();

        $data = $this->get('sulu_page.content_repository')->find($id, $locale, $webspaceKey, $mapping, $user);
        $view = $this->view($data);

        return $this->handleView($view);
    }
private function getContent(Request $request, $id)
    {
        $properties = array_filter(explode(',', $request->get('fields', '')));
        $excludeGhosts = $this->getBooleanRequestParameter($request, 'exclude-ghosts', false, false);
        $excludeShadows = $this->getBooleanRequestParameter($request, 'exclude-shadows', false, false);
        $webspaceNodes = $this->getRequestParameter($request, 'webspace-nodes');
        $locale = $this->getRequestParameter($request, 'language', true);
        $webspaceKey = $this->getRequestParameter($request, 'webspace');

        $user = $this->getUser();

        $mapping = MappingBuilder::create()
            ->setHydrateGhost(!$excludeGhosts)
            ->setHydrateShadow(!$excludeShadows)
            ->setResolveConcreteLocales(true)
            ->addProperties($properties)
            ->getMapping();

        $data = $this->get('sulu_page.content_repository')->find($id, $locale, $webspaceKey, $mapping, $user);
        $view = $this->view($data);

        return $this->handleView($view);
    }
private function getContent ( Request $ request , $ id ) { $ properties = array_filter ( explode ( ',' , $ request -> get ( 'fields' , '' ) ) ) ; $ excludeGhosts = $ this -> getBooleanRequestParameter ( $ request , 'exclude-ghosts' , false , false ) ; $ excludeShadows = $ this -> getBooleanRequestParameter ( $ request , 'exclude-shadows' , false , false ) ; $ webspaceNodes = $ this -> getRequestParameter ( $ request , 'webspace-nodes' ) ; $ locale = $ this -> getRequestParameter ( $ request , 'language' , true ) ; $ webspaceKey = $ this -> getRequestParameter ( $ request , 'webspace' ) ; $ user = $ this -> getUser ( ) ; $ mapping = MappingBuilder :: create ( ) -> setHydrateGhost ( ! $ excludeGhosts ) -> setHydrateShadow ( ! $ excludeShadows ) -> setResolveConcreteLocales ( true ) -> addProperties ( $ properties ) -> getMapping ( ) ; $ data = $ this -> get ( 'sulu_page.content_repository' ) -> find ( $ id , $ locale , $ webspaceKey , $ mapping , $ user ) ; $ view = $ this -> view ( $ data ) ; return $ this -> handleView ( $ view ) ; }
Returns single content.

@param Request $request
@param $id

@return \Symfony\Component\HttpFoundation\Response

@throws \Sulu\Component\Rest\Exception\MissingParameterException
@throws \Sulu\Component\Rest\Exception\ParameterDataTypeException
Returns single content .