Programmatically append multiple paragraphs to entity reference field on node I have a paragraph type that contains a text field and a text format field.
I also have a content type that takes an unlimited number of paragraphs of this type.

The paragraph type is called 'questions_and_answers' and the two fields are 'field_question' and 'field_answer'. I'd like to be able to programmatically append 'questions_and_answers' paragraphs to a content type. 

In the example below I'm grabbing the content from a 'double' field and importing them into the paragraph reference field. 
Here's my code so far.

    $nids = \Drupal::entityQuery('node')
        -&gt;condition('type', 'faq')
        -&gt;execute();
    foreach ($nids as $nid) {
        $node      = \Drupal\node\Entity\NODE::load($nid);
        $questions = $node-&gt;field_questions_and_answers-&gt;getValue();
        foreach ($questions as $question) {
            $q         = $question['first'];
            $a         = $question['second'];
            $paragraph = Paragraph::create([
                    'title'          =&gt; $q,
                    'type'           =&gt; 'questions_and_answers',
                    'field_question' =&gt; $q,
                    'field_answer'   =&gt; $a,
                ]);
            $paragraph-&gt;save();
            $node-&gt;field_qs_and_as[] = $paragraph-&gt;id();
        }
        $node-&gt;save();
    }


However when I perform this action the node gets a number of question paragraphs added but they're completely empty and they can't even be deleted. What am I missing? How do you append multiple paragraphs you created to an entity reference field on a node?
When you add a paragraph you also need to pass the revision id:

  $node-&gt;field_qs_and_as[] = [
    'target_id' =&gt; $paragraph-&gt;id(),
    'target_revision_id' =&gt; $paragraph-&gt;getRevisionId(),
  ];