You are here

function CourseObjectQuizFulfillment::delete in Course 3.x

Same name and namespace in other branches
  1. 8.3 modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuizFulfillment.php \Drupal\course_quiz\Plugin\course\CourseObject\CourseObjectQuizFulfillment::delete()
  2. 8.2 modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuizFulfillment.php \Drupal\course_quiz\Plugin\course\CourseObject\CourseObjectQuizFulfillment::delete()

Remove all quiz attempts associated with this fulfillment.

Overrides EntityBase::delete

File

modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuizFulfillment.php, line 23

Class

CourseObjectQuizFulfillment
Course fulfillment class for quizzes.

Namespace

Drupal\course_quiz\Plugin\course\CourseObject

Code

function delete() {
  $result_ids = (array) $this
    ->getOption('quiz_result_ids');
  $controller = \Drupal::entityTypeManager()
    ->getStorage('quiz_result');
  $entities = $controller
    ->loadMultiple($result_ids);
  $controller
    ->delete($entities);
  parent::delete();
}