diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 079fac3fa..a019f667c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1750,11 +1750,6 @@ parameters: count: 1 path: src/lib/Server/Controller/User.php - - - message: "#^Parameter \\#1 \\$versions of class Ibexa\\\\Rest\\\\Server\\\\Values\\\\VersionList constructor expects array\\, iterable\\ given\\.$#" - count: 1 - path: src/lib/Server/Controller/User.php - - message: "#^Parameter \\#5 \\$relations of class Ibexa\\\\Rest\\\\Server\\\\Values\\\\RestUser constructor expects array\\, iterable\\ given\\.$#" count: 5 diff --git a/src/lib/Server/Controller/User.php b/src/lib/Server/Controller/User.php index a472eb6df..7661ad598 100644 --- a/src/lib/Server/Controller/User.php +++ b/src/lib/Server/Controller/User.php @@ -17,7 +17,9 @@ use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\DraftList\ContentDraftListItemInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\User as RepositoryUser; use Ibexa\Contracts\Core\Repository\Values\User\UserGroupRoleAssignment; use Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment; @@ -577,11 +579,17 @@ public function loadUserGroupsAssignedToRole($roleId): array */ public function loadUserDrafts(int $userId, Request $request): Values\VersionList { - $contentDrafts = $this->contentService->loadContentDrafts( + $contentDrafts = $this->contentService->loadContentDraftList( $this->userService->loadUser($userId) ); - return new Values\VersionList($contentDrafts, $request->getPathInfo()); + return new Values\VersionList( + array_filter(array_map( + static fn (ContentDraftListItemInterface $draftListItem): ?VersionInfo => $draftListItem->getVersionInfo(), + $contentDrafts->items + )), + $request->getPathInfo() + ); } /**