diff --git a/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php b/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php index 99c68a9e33..78af5df304 100644 --- a/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php +++ b/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php @@ -9,16 +9,16 @@ namespace EzSystems\EzPlatformAdminUi\Pagination\Mapper; use eZ\Publish\API\Repository\ContentTypeService; +use eZ\Publish\API\Repository\Exceptions\NotFoundException; use eZ\Publish\API\Repository\LanguageService; use eZ\Publish\API\Repository\UserService; use eZ\Publish\API\Repository\Values\Content\Content; -use eZ\Publish\API\Repository\Values\Content\ContentInfo; use eZ\Publish\API\Repository\Values\Content\Language; +use eZ\Publish\API\Repository\Values\Content\VersionInfo; use eZ\Publish\API\Repository\Values\User\User; use eZ\Publish\Core\Helper\TranslationHelper; use eZ\Publish\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use EzSystems\EzPlatformAdminUi\Specification\ContentIsUser; -use EzSystems\EzPlatformAdminUi\Specification\UserExists; abstract class AbstractPagerContentToDataMapper { @@ -88,19 +88,17 @@ protected function isContentIsUser(Content $content): bool } /** - * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo + * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo * * @return \eZ\Publish\API\Repository\Values\User\User|null */ - protected function getContributor(ContentInfo $contentInfo): ?User + protected function getVersionContributor(VersionInfo $versionInfo): ?User { - $userExists = (new UserExists($this->userService))->isSatisfiedBy($contentInfo->ownerId); - - if (false === $userExists) { + try { + return $this->userService->loadUser($versionInfo->creatorId); + } catch (NotFoundException $e) { return null; } - - return $this->userService->loadUser($contentInfo->ownerId); } /** diff --git a/src/lib/Tab/Dashboard/PagerContentToDataMapper.php b/src/lib/Tab/Dashboard/PagerContentToDataMapper.php index c0f56de2ee..e2cfb7b256 100644 --- a/src/lib/Tab/Dashboard/PagerContentToDataMapper.php +++ b/src/lib/Tab/Dashboard/PagerContentToDataMapper.php @@ -84,7 +84,7 @@ public function map(Pagerfanta $pager): array 'contentId' => $content->id, 'name' => $this->translationHelper->getTranslatedContentName($content), 'language' => $contentInfo->mainLanguageCode, - 'contributor' => $this->getContributor($contentInfo), + 'contributor' => $this->getVersionContributor($content->versionInfo), 'version' => $content->versionInfo->versionNo, 'content_type' => $content->getContentType(), 'modified' => $content->versionInfo->modificationDate,