Skip to content

Commit

Permalink
Revert "Bug #201: Fixed infinite loop"
Browse files Browse the repository at this point in the history
This reverts commit aa22ffd.
  • Loading branch information
samdark committed Feb 22, 2019
1 parent 1d2cdec commit 9bf4060
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions ActiveDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ protected function prepareModels()
}

$query = clone $this->query;

$results = $query->search($this->db);
$this->setQueryResults(is_array($results) ? $results : []);

if (($pagination = $this->getPagination()) !== false) {
// pagination fails to validate page number, because total count is unknown at this stage
$pagination->validatePage = false;
Expand All @@ -99,11 +95,15 @@ protected function prepareModels()
$query->addOrderBy($sort->getOrders());
}

if ($pagination !== false) {
$pagination->totalCount = $this->getTotalCount();
if (is_array(($results = $query->search($this->db)))) {
$this->setQueryResults($results);
if ($pagination !== false) {
$pagination->totalCount = $this->getTotalCount();
}
return $results['hits']['hits'];
}

return $results['hits']['hits'];
$this->setQueryResults([]);
return [];
}

/**
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Yii Framework 2 elasticsearch extension Change Log
2.0.6 under development
-----------------------

- Bug #201: Fixed infinite loop (GHopperMSK)
- Bug #180: Fixed `count()` compatibility with PHP 7.2 to not call it on scalar values (cebe)


Expand Down

0 comments on commit 9bf4060

Please sign in to comment.