public function loadSubUserGroups($groupPath, Request $request)
{
$offset = $request->query->has('offset') ? (int) $request->query->get('offset') : 0;
$limit = $request->query->has('limit') ? (int) $request->query->get('limit') : 25;
$userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
$userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
$subGroups = $this->userService->loadSubUserGroups($userGroup, $offset >= 0 ? $offset : 0, $limit >= 0 ? $limit : 25);
$restUserGroups = array();
foreach ($subGroups as $subGroup) {
$subGroupContentInfo = $subGroup->getVersionInfo()->getContentInfo();
$subGroupLocation = $this->locationService->loadLocation($subGroupContentInfo->mainLocationId);
$contentType = $this->contentTypeService->loadContentType($subGroupContentInfo->contentTypeId);
$restUserGroups[] = new Values\RestUserGroup($subGroup, $contentType, $subGroupContentInfo, $subGroupLocation, $this->contentService->loadRelations($subGroup->getVersionInfo()));
}
if ($this->getMediaType($request) === 'application/vnd.ez.api.usergrouplist') {
return new Values\CachedValue(new Values\UserGroupList($restUserGroups, $request->getPathInfo()), array('locationId' => $userGroupLocation->id));
}
return new Values\CachedValue(new Values\UserGroupRefList($restUserGroups, $request->getPathInfo()), array('locationId' => $userGroupLocation->id));
}