Skip to content

Commit da094da

Browse files
committed
RelationController.php: Use loadRelationList instead of loadRelations
loadRelations is deprecated in 4.5, and removed in 5.0 Fix "Call to an undefined method Ibexa\Contracts\Core\Repository\ContentService::loadRelations()." on PHPStan + 5.0
1 parent 5bb1f2d commit da094da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

code_samples/front/embed_content/src/Controller/RelationController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public function showContentAction(View $view, $locationId): View
2525
$location = $this->locationService->loadLocation($locationId);
2626
$contentInfo = $location->getContentInfo();
2727
$versionInfo = $this->contentService->loadVersionInfo($contentInfo);
28-
$relations = $this->contentService->loadRelations($versionInfo);
28+
$relationList = $this->contentService->loadRelationList($versionInfo);
2929

3030
$items = [];
3131

32-
foreach ($relations as $relation) {
33-
if (in_array($relation->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) {
34-
$items[] = $this->contentService->loadContentByContentInfo($relation->getDestinationContentInfo());
32+
foreach ($relationList as $relationListItem) {
33+
if (in_array($relationListItem->getRelation()->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) {
34+
$items[] = $this->contentService->loadContentByContentInfo($relationListItem->getRelation()->getDestinationContentInfo());
3535
}
3636
}
3737

0 commit comments

Comments
 (0)