Saving multiple field values in a users entity I am trying to reference other nodes on the user entity on field_clinic but everything else is saving except that multiple value field. What could i be doing wrong. The field_clinic accepts multiple values. Below is my code:

$clinics = [

        array('value' =&gt; 132),
        array('value' =&gt; 133),
        array('value' =&gt; 134),
    ];



    // if the user exsists update basestation
    $UserEntity = User::create([
        'name' =&gt; 'Final',
        'roles' =&gt; array('subscriber'),
        'field_age' =&gt; '2',
        'field_city' =&gt; 12,
        'field_clinic' =&gt; $clinics,
        'field_base_statition' =&gt;  $bs_nid


    ]);

    $UserEntity-&gt;save();


The clinics array contains the node ids that I am trying to reference. Please help
The way you're setting the values may be failing to work if you've got the wrong keys in your array - setting any field from code requires you to know how that specific field type stores its data in the entity.

If you're not sure about that key, using the devel module you can simply save one of those users filling the field_clinic field with appropriate values then switch to the devel tab for that user and inspect what keys are actually being used to store the values in that field (probably one named target_id).

According to what you find there, fixing your code may be just matter of changing this:

$clinics = [
    array('value' =&gt; 132),
    array('value' =&gt; 133),
    array('value' =&gt; 134),
];


to this:

$clinics = [
    ['target_id' =&gt; 132],
    ['target_id' =&gt; 133],
    ['target_id' =&gt; 134],
];


(disregard the difference between declaring an array using the [] or the array(), I used the former in my edited code just for coherency)