drupal 8 programmatically saving node doesn't save custom field values code example
Example: drupal 8 programmatically saving node doesn't save custom field values
use Drupal\node\Entity\Node;
$my_article = Node::create(['type' => 'article']);
$my_article->set('title', 'My article');
$my_article->set('field_text', 'My text');
$my_article->set('field_image', FID);
$my_article->set('field_user', UID);
$my_article->enforceIsNew();
$my_article->save();