8 – How to know what setSetting is supposed to be?

I create a custom content entity, and in BaseFieldDefinitions, I try to create a field to assign a user as a designated assignor and follow up with an assignee. Until now, the code has been quite easy to follow and logical, with the exception of setSetting.

Basically, the field below works, but its copy and this one are pasted from the Drupal console as boiler plate code. What I do not understand is the setSetting part. If I comment -> setSetting (& # 39; target_type & # 39 ;, & # 39; user & # 39;), the field is displayed but no longer works.

So my question is: how do I suppose to know or understand that I should enter "target_type" and the value "user"? I have browsed the API but I have not managed to find any references to that. And I do not understand either the setSetting below, & # 39; handler & # 39; = & # 39; default. I can comment on that and it works well. So what gives?

How am I supposed to know what to set in the setSettings part? As I also noticed, not all field definitions have this.

$ fields['assigner'] = BaseFieldDefinition :: create (& # 39; entity reference & # 39;)
-> setLabel (t (Assign & # 39;))
-> setDescription (& # 39; The person who will issue this task.
-> setRevisionable (TRUE)
-> setSetting (& # 39; target_type & # 39 ;, & # 39; user & # 39;)
-> setSetting ('manager', 'default')
-> setTranslatable (TRUE)
-> setDisplayOptions (& # 39; view & # 39 ;, [
      'label' => 'hidden',
      'type' => 'author',
      'weight' => 0,
  ])
-> setDisplayOptions ('form', [
      'type' => 'entity_reference_autocomplete',
      'weight' => 5,
      'settings' => [
          'match_operator' => 'CONTAINS',
          'size' => '60',
          'autocomplete_type' => 'tags',
          'placeholder' => '',
      ],
])
-> setDisplayConfigurable (& # 39; form & # 39; TRUE)
-> setDisplayConfigurable (& # 39; view & # 39; TRUE);