public function loadContent($contentId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);

        $mainLocation = null;
        if (!empty($contentInfo->mainLocationId)) {
            $mainLocation = $this->repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
        }

        $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);

        $contentVersion = null;
        $relations = null;
        if ($this->getMediaType($request) === 'application/vnd.ez.api.content') {
            $languages = Language::ALL;
            if ($request->query->has('languages')) {
                $languages = explode(',', $request->query->get('languages'));
            }

            $contentVersion = $this->repository->getContentService()->loadContent($contentId, $languages);
            $relations = $this->repository->getContentService()->loadRelations($contentVersion->getVersionInfo());
        }

        $restContent = new Values\RestContent(
            $contentInfo,
            $mainLocation,
            $contentVersion,
            $contentType,
            $relations,
            $request->getPathInfo()
        );

        if ($contentInfo->mainLocationId === null) {
            return $restContent;
        }

        return new Values\CachedValue(
            $restContent,
            array('locationId' => $contentInfo->mainLocationId)
        );
    }
public function loadContent($contentId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);

        $mainLocation = null;
        if (!empty($contentInfo->mainLocationId)) {
            $mainLocation = $this->repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
        }

        $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);

        $contentVersion = null;
        $relations = null;
        if ($this->getMediaType($request) === 'application/vnd.ez.api.content') {
            $languages = Language::ALL;
            if ($request->query->has('languages')) {
                $languages = explode(',', $request->query->get('languages'));
            }

            $contentVersion = $this->repository->getContentService()->loadContent($contentId, $languages);
            $relations = $this->repository->getContentService()->loadRelations($contentVersion->getVersionInfo());
        }

        $restContent = new Values\RestContent(
            $contentInfo,
            $mainLocation,
            $contentVersion,
            $contentType,
            $relations,
            $request->getPathInfo()
        );

        if ($contentInfo->mainLocationId === null) {
            return $restContent;
        }

        return new Values\CachedValue(
            $restContent,
            array('locationId' => $contentInfo->mainLocationId)
        );
    }
public function loadContent ( $ contentId , Request $ request ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ mainLocation = null ; if ( ! empty ( $ contentInfo -> mainLocationId ) ) { $ mainLocation = $ this -> repository -> getLocationService ( ) -> loadLocation ( $ contentInfo -> mainLocationId ) ; } $ contentType = $ this -> repository -> getContentTypeService ( ) -> loadContentType ( $ contentInfo -> contentTypeId ) ; $ contentVersion = null ; $ relations = null ; if ( $ this -> getMediaType ( $ request ) === 'application/vnd.ez.api.content' ) { $ languages = Language :: ALL ; if ( $ request -> query -> has ( 'languages' ) ) { $ languages = explode ( ',' , $ request -> query -> get ( 'languages' ) ) ; } $ contentVersion = $ this -> repository -> getContentService ( ) -> loadContent ( $ contentId , $ languages ) ; $ relations = $ this -> repository -> getContentService ( ) -> loadRelations ( $ contentVersion -> getVersionInfo ( ) ) ; } $ restContent = new Values \ RestContent ( $ contentInfo , $ mainLocation , $ contentVersion , $ contentType , $ relations , $ request -> getPathInfo ( ) ) ; if ( $ contentInfo -> mainLocationId === null ) { return $ restContent ; } return new Values \ CachedValue ( $ restContent , array ( 'locationId' => $ contentInfo -> mainLocationId ) ) ; }
Loads a content info, potentially with the current version embedded.

@param mixed $contentId
@param \Symfony\Component\HttpFoundation\Request $request

@return \eZ\Publish\Core\REST\Server\Values\RestContent
Loads a content info potentially with the current version embedded .