eZ\Publish\Core\FieldType\Relation\Type::getRelations PHP Method

getRelations() public method

Not intended for \eZ\Publish\API\Repository\Values\Content\Relation::COMMON type relations, there is an API for handling those.
public getRelations ( eZ\Publish\SPI\FieldType\Value $fieldValue ) : array
$fieldValue eZ\Publish\SPI\FieldType\Value
return array Hash with relation type as key and array of destination content ids as value. Example: array( \eZ\Publish\API\Repository\Values\Content\Relation::LINK => array( "contentIds" => array( 12, 13, 14 ), "locationIds" => array( 24 ) ), \eZ\Publish\API\Repository\Values\Content\Relation::EMBED => array( "contentIds" => array( 12 ), "locationIds" => array( 24, 45 ) ), \eZ\Publish\API\Repository\Values\Content\Relation::ATTRIBUTE => array( 12 ) )
    public function getRelations(SPIValue $fieldValue)
    {
        $relations = array();
        if ($fieldValue->destinationContentId !== null) {
            $relations[Relation::FIELD] = array($fieldValue->destinationContentId);
        }
        return $relations;
    }