Filling an Entity Reference programatically
You have to specify the entity id and the entity type. The example is referencing a node but you want to reference a user.

Try this:

$node-&gt;field_customer_nid[$node-&gt;language][] = array(
  'target_id' =&gt; $entity_id,
);


$entity_id should hold the referenced entity id.