How to copy current user'id to a custom field when adding a new entity? I have a custom content entity 'service' created with Drupal Console (drupal generate:entity:content).
I added my own fields to the standard ones created by DC. Of which 'seliste_id':  

$fields['seliste_id'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('SEListe'))
  -&gt;setSetting('target_type', 'person')
  -&gt;setSetting('handler', 'default');


By default, the code generated by DC handles the owner of any new entity, owner_id being the id of the current user.
By design, seliste_id is the id of the other entity 'person' which is linked 1 &lt;-> 1 to Drupal's 'user'.
So when a new 'service' is created, I'd like to "copy" its owner (i.e. the current user's id) to 'seliste_id'.
I know that I can do that in mymodule_entity_presave().
Is there a way to do that in the definition of 'seliste_id' field?
With -&gt;setDefaultValue() or -&gt;setDefaultValueCallback() maybe?
Any idea?
You probably want to use the setValue() function, like this:

$user = \Drupal::currentUser();      
$node-&gt;FIELD_NAME-&gt;setValue(['value' =&gt; $user-&gt;id());