eZ\Publish\Core\REST\Server\Controller\Content::loadVersionRelations PHP Method

loadVersionRelations() public method

Loads the relations of the given version.
public loadVersionRelations ( mixed $contentId, mixed $versionNumber, Request $request ) : RelationList
$contentId mixed
$versionNumber mixed
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RelationList
    public function loadVersionRelations($contentId, $versionNumber, Request $request)
    {
        $offset = $request->query->has('offset') ? (int) $request->query->get('offset') : 0;
        $limit = $request->query->has('limit') ? (int) $request->query->get('limit') : -1;
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
        $relationList = $this->repository->getContentService()->loadRelations($this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber));
        $relationList = array_slice($relationList, $offset >= 0 ? $offset : 0, $limit >= 0 ? $limit : null);
        $relationListValue = new Values\RelationList($relationList, $contentId, $versionNumber, $request->getPathInfo());
        if ($contentInfo->mainLocationId === null) {
            return $relationListValue;
        }
        return new Values\CachedValue($relationListValue, array('locationId' => $contentInfo->mainLocationId));
    }