Set value for custom field


I created a custom field but I don’t know how to set a value.
I can read values with


The field consists of several elements: value, data, api_key

I’m loading the entity and would like to set the values of the field programatically, I tried:

$entity->set('field_myfield', ['data' => 'some data'], 'value' => 'some value');

This doesn’t work.

قالب وردپرس