public function PollVoteStorage::deleteVotes in Poll 8
Delete a user's votes for a poll.
Parameters
PollInterface $poll:
Return value
mixed
Overrides PollVoteStorageInterface::deleteVotes
File
- src/
PollVoteStorage.php, line 60
Class
- PollVoteStorage
- Controller class for poll vote storage.
Namespace
Drupal\pollCode
public function deleteVotes(PollInterface $poll) {
$this->connection
->delete('poll_vote')
->condition('pid', $poll
->id())
->execute();
// Deleting a vote means that any cached vote might not be updated in the
// UI, so we need to invalidate them all.
$this->cacheTagsInvalidator
->invalidateTags([
'poll-votes:' . $poll
->id(),
]);
// Invalidate the static cache of votes.
$this->currentUserVote = [];
}