Commit f8534d1c authored by git's avatar git Committed by Devin Zuczek
Browse files

Issue #3300160 by Rhezios: Call to undefined method...

Issue #3300160 by Rhezios: Call to undefined method Drupal\paragraphs\Entity\Paragraph::copyFromRevision() after paragraph with entity reference duplication
parent c43cee24
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -17,17 +17,18 @@ class QuizEventSubscriber implements EventSubscriberInterface {
  }

  /**
   * If the current node is a course object, fulfill it for the current user.
   * Copy questions to a new quiz revision.
   *
   * @param ReplicateEntityEvent $event
   * @param AfterSaveEvent $event
   */
  public function afterSave(AfterSaveEvent $event) {
    /* @var $quiz Quiz */
    $quiz = $event->getEntity();
    $entity = $event->getEntity();
    if ($entity->getEntityTypeId() == 'quiz') {
      $old_quiz = Drupal::entityTypeManager()
        ->getStorage('quiz')
      ->loadRevision($quiz->old_vid);
    $quiz->copyFromRevision($old_quiz);
        ->loadRevision($entity->old_vid);
      $entity->copyFromRevision($old_quiz);
    }
  }

}