Example with "normal" entity reference.
$node = node_load($nid);
$node->field_reference = array(
$node->language => array(0 => array(
'target_id' => $other_nid,
))
);
node_save($node);
Now I want to do the same, but on a File entity field instead. Examining an attached file with devel, the field looks mostly like a plain
$file = file_load($fid);
object, but there's some more data on it, so I'm guessing I will hit problems down the road if I just stick the $file on to the ref, instead of figuring out the proper API call.