You are here

public function MatchingResponse::delete in Quiz 8.4

Implementation of delete

Overrides QuizQuestionResponse::delete

See also

QuizQuestionResponse#delete()

File

question_types/matching/lib/Drupal/matching/MatchingResponse.php, line 73

Class

MatchingResponse
Extension of QuizQuestionResponse

Namespace

Drupal\matching

Code

public function delete() {
  $match_id = db_query('SELECT match_id FROM {quiz_matching_node} WHERE nid = :nid AND vid = :vid', array(
    ':nid' => $this->question
      ->id(),
    ':vid' => $this->question
      ->getRevisionId(),
  ))
    ->fetchCol();
  db_delete('quiz_matching_user_answers')
    ->condition('match_id', is_array($match_id) ? $match_id : array(
    0,
  ), 'IN')
    ->condition('result_id', $this->rid)
    ->execute();
}