eZ\Publish\Core\Repository\ContentService::loadReverseRelations PHP Method

loadReverseRelations() public method

The relations come only from published versions of the source content objects
public loadReverseRelations ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : eZ\Publish\API\Repository\Values\Content\Relation[]
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
return eZ\Publish\API\Repository\Values\Content\Relation[]
    public function loadReverseRelations(ContentInfo $contentInfo)
    {
        if ($this->repository->hasAccess('content', 'reverserelatedlist') !== true) {
            throw new UnauthorizedException('content', 'reverserelatedlist', array('contentId' => $contentInfo->id));
        }
        $spiRelations = $this->persistenceHandler->contentHandler()->loadReverseRelations($contentInfo->id);
        $returnArray = array();
        foreach ($spiRelations as $spiRelation) {
            $sourceContentInfo = $this->internalLoadContentInfo($spiRelation->sourceContentId);
            if (!$this->repository->canUser('content', 'read', $sourceContentInfo)) {
                continue;
            }
            $returnArray[] = $this->domainMapper->buildRelationDomainObject($spiRelation, $sourceContentInfo, $contentInfo);
        }
        return $returnArray;
    }