Skip to content

Commit f387c48

Browse files
committed
IBX-8534: Dropped ContentService::loadRelations usage
1 parent 514f0e5 commit f387c48

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,6 @@ parameters:
630630
count: 1
631631
path: src/lib/Resolver/ContentResolver.php
632632

633-
-
634-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ContentResolver\\:\\:findContentRelations\\(\\) should return array\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\> but returns iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Relation\\>\\.$#"
635-
count: 1
636-
path: src/lib/Resolver/ContentResolver.php
637-
638633
-
639634
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ContentResolver\\:\\:findContentReverseRelations\\(\\) has no return type specified\\.$#"
640635
count: 1
@@ -680,11 +675,6 @@ parameters:
680675
count: 1
681676
path: src/lib/Resolver/ContentResolver.php
682677

683-
-
684-
message: "#^Property Ibexa\\\\GraphQL\\\\Resolver\\\\ContentResolver\\:\\:\\$contentTypeService is never read, only written\\.$#"
685-
count: 1
686-
path: src/lib/Resolver/ContentResolver.php
687-
688678
-
689679
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\ContentThumbnailResolver\\:\\:resolveContentThumbnail\\(\\) return type has no value type specified in iterable type array\\.$#"
690680
count: 1

src/lib/Resolver/ContentResolver.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Ibexa\Contracts\Core\Repository\SearchService;
1313
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
1414
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
15+
use Ibexa\Contracts\Core\Repository\Values\Content\Relation;
16+
use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface;
1517
use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit;
1618
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
1719

@@ -30,16 +32,11 @@ class ContentResolver
3032
*/
3133
private $searchService;
3234

33-
/**
34-
* @var \Ibexa\Contracts\Core\Repository\ContentTypeService
35-
*/
36-
private $contentTypeService;
3735

38-
public function __construct(ContentService $contentService, SearchService $searchService, ContentTypeService $contentTypeService)
36+
public function __construct(ContentService $contentService, SearchService $searchService)
3937
{
4038
$this->contentService = $contentService;
4139
$this->searchService = $searchService;
42-
$this->contentTypeService = $contentTypeService;
4340
}
4441

4542
public function findContentByType($contentTypeId)
@@ -63,9 +60,12 @@ static function (SearchHit $searchHit) {
6360
*/
6461
public function findContentRelations(ContentInfo $contentInfo, $version = null)
6562
{
66-
return $this->contentService->loadRelations(
67-
$this->contentService->loadVersionInfo($contentInfo, $version)
68-
);
63+
return array_filter(array_map(
64+
static fn (RelationListItemInterface $relationListItem): ?Relation => $relationListItem->getRelation(),
65+
$this->contentService->loadRelationList(
66+
$this->contentService->loadVersionInfo($contentInfo, $version)
67+
)->items
68+
));
6969
}
7070

7171
public function findContentReverseRelations(ContentInfo $contentInfo)

0 commit comments

Comments
 (0)