saving user field type custom field - Failed to set unsafe attribute I have tried to save a custom field of "user field" type which resulted in this error.


  "Failed to set unsafe attribute"


code:

$order-&gt;setAttributes(array(
    'operatorUid' =&gt; Craft::$app-&gt;user-&gt;id
));


Has anyone encountered a similar issue or can you let me know how to save a custom userType field to an order?
In order to set field values there is setFieldValue function

$element-&gt;setFieldValue('fieldHandle', [Craft::$app-&gt;getUser()-&gt;getIdentity()-&gt;id]);


All relation fields only accept the values as an array [1] rather than integer 1