You are here

public function PollVoteStorage::getTotalVotes in Poll 8

Get total votes for a poll.

Parameters

PollInterface $poll:

Return value

mixed

Overrides PollVoteStorageInterface::getTotalVotes

File

src/PollVoteStorage.php, line 163

Class

PollVoteStorage
Controller class for poll vote storage.

Namespace

Drupal\poll

Code

public function getTotalVotes(PollInterface $poll) {
  $query = $this->connection
    ->query("SELECT COUNT(chid) FROM {poll_vote} WHERE pid = :pid", array(
    ':pid' => $poll
      ->id(),
  ));
  return $query
    ->fetchField();
}