public function loadRelations(APIVersionInfo $versionInfo)
    {
        if ($versionInfo->isPublished()) {
            $function = 'read';
        } else {
            $function = 'versionread';
        }

        if (!$this->repository->canUser('content', $function, $versionInfo)) {
            throw new UnauthorizedException('content', $function);
        }

        $contentInfo = $versionInfo->getContentInfo();
        $spiRelations = $this->persistenceHandler->contentHandler()->loadRelations(
            $contentInfo->id,
            $versionInfo->versionNo
        );

        /** @var $relations \eZ\Publish\API\Repository\Values\Content\Relation[] */
        $relations = array();
        foreach ($spiRelations as $spiRelation) {
            $destinationContentInfo = $this->internalLoadContentInfo($spiRelation->destinationContentId);
            if (!$this->repository->canUser('content', 'read', $destinationContentInfo)) {
                continue;
            }

            $relations[] = $this->domainMapper->buildRelationDomainObject(
                $spiRelation,
                $contentInfo,
                $destinationContentInfo
            );
        }

        return $relations;
    }
public function loadRelations(APIVersionInfo $versionInfo)
    {
        if ($versionInfo->isPublished()) {
            $function = 'read';
        } else {
            $function = 'versionread';
        }

        if (!$this->repository->canUser('content', $function, $versionInfo)) {
            throw new UnauthorizedException('content', $function);
        }

        $contentInfo = $versionInfo->getContentInfo();
        $spiRelations = $this->persistenceHandler->contentHandler()->loadRelations(
            $contentInfo->id,
            $versionInfo->versionNo
        );

        /** @var $relations \eZ\Publish\API\Repository\Values\Content\Relation[] */
        $relations = array();
        foreach ($spiRelations as $spiRelation) {
            $destinationContentInfo = $this->internalLoadContentInfo($spiRelation->destinationContentId);
            if (!$this->repository->canUser('content', 'read', $destinationContentInfo)) {
                continue;
            }

            $relations[] = $this->domainMapper->buildRelationDomainObject(
                $spiRelation,
                $contentInfo,
                $destinationContentInfo
            );
        }

        return $relations;
    }
public function loadRelations ( APIVersionInfo $ versionInfo ) { if ( $ versionInfo -> isPublished ( ) ) { $ function = 'read' ; } else { $ function = 'versionread' ; } if ( ! $ this -> repository -> canUser ( 'content' , $ function , $ versionInfo ) ) { throw new UnauthorizedException ( 'content' , $ function ) ; } $ contentInfo = $ versionInfo -> getContentInfo ( ) ; $ spiRelations = $ this -> persistenceHandler -> contentHandler ( ) -> loadRelations ( $ contentInfo -> id , $ versionInfo -> versionNo ) ; /** @var $relations \eZ\Publish\API\Repository\Values\Content\Relation[] */ $ relations = array ( ) ; foreach ( $ spiRelations as $ spiRelation ) { $ destinationContentInfo = $ this -> internalLoadContentInfo ( $ spiRelation -> destinationContentId ) ; if ( ! $ this -> repository -> canUser ( 'content' , 'read' , $ destinationContentInfo ) ) { continue ; } $ relations [ ] = $ this -> domainMapper -> buildRelationDomainObject ( $ spiRelation , $ contentInfo , $ destinationContentInfo ) ; } return $ relations ; }
Loads all outgoing relations for the given version.

@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version

@param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo

@return \eZ\Publish\API\Repository\Values\Content\Relation[]
Loads all outgoing relations for the given version .