Skip to content

Commit

Permalink
IBX-8534: Dropped usage of deprecated contentService::loadContentDraf…
Browse files Browse the repository at this point in the history
…ts method (#134)

* IBX-8534: Dropped usage of deprecated contentService::loadContentDrafts method

* Fixed phpstan issues
  • Loading branch information
ViniTou authored Oct 7, 2024
1 parent 9d59dc8 commit 0955cbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\VersionInfo\\>, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\VersionInfo\\> given\\.$#"
count: 1
path: src/lib/Server/Controller/User.php

-
message: "#^Parameter \\#5 \\$relations of class Ibexa\\\\Rest\\\\Server\\\\Values\\\\RestUser constructor expects array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\>, iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\> given\\.$#"
count: 5
Expand Down
12 changes: 10 additions & 2 deletions src/lib/Server/Controller/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
);
}

/**
Expand Down

0 comments on commit 0955cbf

Please sign in to comment.