public function loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
        $relationList = $this->repository->getContentService()->loadRelations(
            $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
        );

        foreach ($relationList as $relation) {
            if ($relation->id == $relationId) {
                $relation = new Values\RestRelation($relation, $contentId, $versionNumber);

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

                return new Values\CachedValue(
                    $relation,
                    array('locationId' => $contentInfo->mainLocationId)
                );
            }
        }

        throw new Exceptions\NotFoundException("Relation not found: '{$request->getPathInfo()}'.");
    }
public function loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
        $relationList = $this->repository->getContentService()->loadRelations(
            $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
        );

        foreach ($relationList as $relation) {
            if ($relation->id == $relationId) {
                $relation = new Values\RestRelation($relation, $contentId, $versionNumber);

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

                return new Values\CachedValue(
                    $relation,
                    array('locationId' => $contentInfo->mainLocationId)
                );
            }
        }

        throw new Exceptions\NotFoundException("Relation not found: '{$request->getPathInfo()}'.");
    }
public function loadVersionRelation ( $ contentId , $ versionNumber , $ relationId , Request $ request ) { $ contentInfo = $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) ; $ relationList = $ this -> repository -> getContentService ( ) -> loadRelations ( $ this -> repository -> getContentService ( ) -> loadVersionInfo ( $ contentInfo , $ versionNumber ) ) ; foreach ( $ relationList as $ relation ) { if ( $ relation -> id == $ relationId ) { $ relation = new Values \ RestRelation ( $ relation , $ contentId , $ versionNumber ) ; if ( $ contentInfo -> mainLocationId === null ) { return $ relation ; } return new Values \ CachedValue ( $ relation , array ( 'locationId' => $ contentInfo -> mainLocationId ) ) ; } } throw new Exceptions \ NotFoundException ( "Relation not found: '{$request->getPathInfo()}'." ) ; }
Loads a relation for the given content object and version.

@param mixed $contentId
@param int $versionNumber
@param mixed $relationId

@throws \eZ\Publish\Core\REST\Common\Exceptions\NotFoundException

@return \eZ\Publish\Core\REST\Server\Values\RestRelation
Loads a relation for the given content object and version .