Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/bundle/Resources/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ ibexa.rest.load_content_versions:
requirements:
contentId: \d+

ibexa.rest.load_version_info_list_by_content_ids:
path: /content/objects/version-info-list
defaults:
_controller: Ibexa\Rest\Server\Controller\Content:loadVersionInfoListByContentIds
methods: [GET]

ibexa.rest.load_version_relations:
path: /content/objects/{contentId}/versions/{versionNumber}/relations
defaults:
Expand Down
26 changes: 26 additions & 0 deletions src/lib/Server/Controller/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,32 @@ public function loadContentVersions($contentId, Request $request)
);
}

/**
* Returns a list of version info for multiple content IDs.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
*/
public function loadVersionInfoListByContentIds(Request $request): Values\VersionList
{
$contentIds = $request->query->all('content_ids');

if (empty($contentIds)) {
throw new BadRequestException("'content_ids' parameter is required and must contain at least one ID.");
}

$contentService = $this->repository->getContentService();
$contentInfos = $contentService->loadContentInfoList($contentIds);

$versionInfoList = $contentService->loadVersionInfoListByContentInfo($contentInfos);

return new Values\VersionList(
array_values($versionInfoList),
$request->getPathInfo()
);
}

/**
* The version is deleted.
*
Expand Down
Loading