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()}'.");
}