You are here

public function QuizQuestionRelationship::getQuestion in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 src/Entity/QuizQuestionRelationship.php \Drupal\quiz\Entity\QuizQuestionRelationship::getQuestion()
  2. 6.x src/Entity/QuizQuestionRelationship.php \Drupal\quiz\Entity\QuizQuestionRelationship::getQuestion()

Get the question associated with this relationship.

Parameters

bool $latest_revision: Get the latest revision instead of the current.

Return value

QuizQuestion

File

src/Entity/QuizQuestionRelationship.php, line 126

Class

QuizQuestionRelationship
Defines the Quiz entity class.

Namespace

Drupal\quiz\Entity

Code

public function getQuestion($latest_revision = FALSE) {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('quiz_question');
  if ($latest_revision) {
    return $storage
      ->loadRevision($this
      ->get('question_vid')
      ->getString());
  }
  else {
    return $storage
      ->loadRevision($this
      ->get('question_id')
      ->getString());
  }
}