protected function getEmbedData(DataObject $record, $relationName)
    {
        if ($record->hasMethod($relationName)) {
            $relationData = $record->$relationName();
            if ($relationData instanceof RelationList) {
                return $this->formatDataList($relationData);
            } else {
                return $this->formatDataObject($relationData);
            }
        }

        return null;
    }
protected function getEmbedData(DataObject $record, $relationName)
    {
        if ($record->hasMethod($relationName)) {
            $relationData = $record->$relationName();
            if ($relationData instanceof RelationList) {
                return $this->formatDataList($relationData);
            } else {
                return $this->formatDataObject($relationData);
            }
        }

        return null;
    }
protected function getEmbedData ( DataObject $ record , $ relationName ) { if ( $ record -> hasMethod ( $ relationName ) ) { $ relationData = $ record -> $ relationName ( ) ; if ( $ relationData instanceof RelationList ) { return $ this -> formatDataList ( $ relationData ) ; } else { return $ this -> formatDataObject ( $ relationData ) ; } } return null ; }
Returns a DataObject relation's data formatted and ready to embed.

@param  DataObject $record       The DataObject to get the data from
@param  string     $relationName The name of the relation
@return array|null               Formatted DataObject or RelationList ready to embed or null if nothing to embed
Returns a DataObject relation s data formatted and ready to embed .