You are here

public function PollStorage::getExpiredPolls in Poll 8

Returns all expired polls.

Return value

\Drupal\poll\PollInterface[]

Overrides PollStorageInterface::getExpiredPolls

File

src/PollStorage.php, line 85

Class

PollStorage
Controller class for polls.

Namespace

Drupal\poll

Code

public function getExpiredPolls() {
  $query = $this->database
    ->query('SELECT id FROM {poll_field_data} WHERE (:timestamp > (created + runtime)) AND status = 1 AND runtime <> 0', [
    ':timestamp' => \Drupal::time()
      ->getCurrentTime(),
  ]);
  return $this
    ->loadMultiple($query
    ->fetchCol());
}