You are here

class CourseObjectPollFulfillment in Course 8.2

Same name and namespace in other branches
  1. 8.3 modules/course_poll/src/Course/Object/CourseObjectPollFulfillment.php \Drupal\course_poll\Course\Object\CourseObjectPollFulfillment

Hierarchy

  • class \Drupal\course_poll\Course\Object\CourseObjectPollFulfillment extends \Drupal\course_poll\Course\Object\CourseObjectNodeFulfillment

Expanded class hierarchy of CourseObjectPollFulfillment

File

modules/course_poll/src/Course/Object/CourseObjectPollFulfillment.php, line 7

Namespace

Drupal\course_poll\Course\Object
View source
class CourseObjectPollFulfillment extends CourseObjectNodeFulfillment {

  /**
   * Remove poll votes for this user.
   */
  function delete() {
    $account = Drupal\user\Entity\User::load($this->uid);
    \Drupal::database()
      ->delete('poll_vote')
      ->condition('nid', $this
      ->getCourseObject()
      ->getInstanceId())
      ->condition('uid', $account->uid)
      ->execute();
    db_update('poll_choice')
      ->expression('chvotes', 'chvotes - 1')
      ->condition('chid', $this
      ->getOption('instance'))
      ->execute();
    parent::delete();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CourseObjectPollFulfillment::delete function Remove poll votes for this user.