CourseObjectPollFulfillment.php in Course 3.x
File
modules/course_poll/src/Plugin/course/CourseObject/CourseObjectPollFulfillment.phpView source
<?php
namespace Drupal\course_poll\Plugin\course\CourseObject;
use Drupal;
use Drupal\course\Entity\CourseObjectFulfillment;
use Drupal\user\Entity\User;
class CourseObjectPollFulfillment extends CourseObjectFulfillment {
/**
* Remove poll votes for this user.
*/
function delete() {
$account = User::load($this->uid);
Drupal::database()
->delete('poll_vote')
->condition('nid', $this
->getCourseObject()
->getInstanceId())
->condition('uid', $account->uid)
->execute();
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
Drupal::database()
->update('poll_choice')
->expression('chvotes', 'chvotes - 1')
->condition('chid', $this
->getOption('instance'))
->execute();
parent::delete();
}
}
Classes
Name![]() |
Description |
---|---|
CourseObjectPollFulfillment |