Skip to content

Commit

Permalink
IBX-6484: Fixed Content Handler loadVersionInfoList database error
Browse files Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-6484 and #384

Key changes:

* Added check if `$row` is empty to prevent a database error in persistence Content Handler `loadVersionInfoList`.
  • Loading branch information
mateuszdebinski authored Sep 27, 2023
1 parent a53f741 commit c225702
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions eZ/Publish/Core/Persistence/Legacy/Content/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,11 @@ static function ($lang) use ($languageCode) {
public function loadVersionInfoList(array $contentIds): array
{
$rows = $this->contentGateway->loadVersionInfoList($contentIds);

if (empty($rows)) {
return [];
}

$mappedRows = array_map(
static function (array $row): array {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ public function testLoadVersionInfoListByContentInfo(): void
self::assertEquals($loadedVersionInfo, $versionInfo);
}
}

public function testLoadVersionInfoListByContentInfoForTopLevelNode(): void
{
$contentService = self::getContentService();
$locationService = self::getLocationService();

$location = $locationService->loadLocation(1);

$versionInfoList = $contentService->loadVersionInfoListByContentInfo(
[$location->getContentInfo()]
);

self::assertCount(0, $versionInfoList);
}
}

0 comments on commit c225702

Please sign in to comment.