You are here

public function LongAnswerQuestion::delete in Quiz 8.4

Implementation of delete

Overrides QuizQuestion::delete

See also

QuizQuestion#delete($only_this_version)

File

question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php, line 65
Long answer classes.

Class

LongAnswerQuestion
Extension of QuizQuestion.

Namespace

Drupal\long_answer

Code

public function delete($only_this_version = FALSE) {
  if ($only_this_version) {
    db_delete('quiz_long_answer_user_answers')
      ->condition('question_nid', $this->node
      ->id())
      ->condition('question_vid', $this->node
      ->getRevisionId())
      ->execute();
    db_delete('quiz_long_answer_node_properties')
      ->condition('nid', $this->node
      ->id())
      ->condition('vid', $this->node
      ->getRevisionId())
      ->execute();
  }
  else {
    db_delete('quiz_long_answer_node_properties')
      ->condition('nid', $this->node
      ->id())
      ->execute();
    db_delete('quiz_long_answer_user_answers')
      ->condition('question_nid', $this->node
      ->id())
      ->execute();
  }
  parent::delete($only_this_version);
}