eZ\Publish\Core\SignalSlot\ContentService::addRelation PHP Method

addRelation() public method

The source of the relation is the content and version referenced by $versionInfo.
public addRelation ( eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent ) : eZ\Publish\API\Repository\Values\Content\Relation
$sourceVersion eZ\Publish\API\Repository\Values\Content\VersionInfo
$destinationContent eZ\Publish\API\Repository\Values\Content\ContentInfo the destination of the relation
return eZ\Publish\API\Repository\Values\Content\Relation the newly created relation
    public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent)
    {
        $returnValue = $this->service->addRelation($sourceVersion, $destinationContent);
        $this->signalDispatcher->emit(new AddRelationSignal(array('srcContentId' => $sourceVersion->contentInfo->id, 'srcVersionNo' => $sourceVersion->versionNo, 'dstContentId' => $destinationContent->id)));
        return $returnValue;
    }