You are here

public function PollStorage::getPollDuplicates in Poll 8

Find all duplicates of a poll by matching the question.

Parameters

PollInterface $poll:

Return value

mixed

Overrides PollStorageInterface::getPollDuplicates

File

src/PollStorage.php, line 61

Class

PollStorage
Controller class for polls.

Namespace

Drupal\poll

Code

public function getPollDuplicates(PollInterface $poll) {
  $query = \Drupal::entityQuery('poll');
  $query
    ->condition('question', $poll
    ->label());
  if ($poll
    ->id()) {
    $query
      ->condition('id', $poll
      ->id(), '<>');
  }
  return $this
    ->loadMultiple($query
    ->execute());
}