public function PollVoteStorage::saveVote in Poll 8
Save a user's vote.
Parameters
array $options:
Overrides PollVoteStorageInterface::saveVote
File
- src/
PollVoteStorage.php, line 99
Class
- PollVoteStorage
- Controller class for poll vote storage.
Namespace
Drupal\pollCode
public function saveVote(array $options) {
if (!is_array($options)) {
return;
}
$this->connection
->insert('poll_vote')
->fields($options)
->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:' . $options['pid'],
]);
// Invalidate the static cache of votes.
$this->currentUserVote = [];
}