Rest/Field/Value.php
private function getRelation(Content $content, $field, $language)
    {
        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);
        $isRelation = (in_array('ezobjectrelation', $fieldDefinitions) && $field == $fieldNames['ezobjectrelation']);

        if ($isRelation && $field == $fieldNames['ezobjectrelation']) {
            $fieldValue = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (isset($fieldValue->destinationContentId)) {
                return $fieldValue->destinationContentId;
            }
        }

        return null;
    }
private function getRelation(Content $content, $field, $language)
    {
        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);
        $isRelation = (in_array('ezobjectrelation', $fieldDefinitions) && $field == $fieldNames['ezobjectrelation']);

        if ($isRelation && $field == $fieldNames['ezobjectrelation']) {
            $fieldValue = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (isset($fieldValue->destinationContentId)) {
                return $fieldValue->destinationContentId;
            }
        }

        return null;
    }
private function getRelation ( Content $ content , $ field , $ language ) { $ fieldDefinitions = $ this -> getFieldDefinitionList ( ) ; $ fieldNames = array_flip ( $ fieldDefinitions ) ; $ isRelation = ( in_array ( 'ezobjectrelation' , $ fieldDefinitions ) && $ field == $ fieldNames [ 'ezobjectrelation' ] ) ; if ( $ isRelation && $ field == $ fieldNames [ 'ezobjectrelation' ] ) { $ fieldValue = $ content -> getFieldValue ( $ fieldNames [ 'ezobjectrelation' ] , $ language ) ; if ( isset ( $ fieldValue -> destinationContentId ) ) { return $ fieldValue -> destinationContentId ; } } return null ; }
Checks if content has image relation field, returns its ID if true.

@param \eZ\Publish\API\Repository\Values\Content\Content $content
@param string $field
@param string $language

@return int|null
Checks if content has image relation field returns its ID if true .