Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / infrastructure / storage / lisk / PhabricatorQueryIterator.php
blobcc88678cdfbf8b74261fc1bfd9b400d01c6af61b
1 <?php
3 final class PhabricatorQueryIterator extends PhutilBufferedIterator {
5 private $query;
6 private $pager;
8 public function __construct(PhabricatorCursorPagedPolicyAwareQuery $query) {
9 $this->query = $query;
12 protected function didRewind() {
13 $pager = new AphrontCursorPagerView();
15 $page_size = $this->getPageSize();
16 $pager->setPageSize($page_size);
18 $this->pager = $pager;
21 public function key() {
22 return $this->current()->getID();
25 protected function loadPage() {
26 if (!$this->pager) {
27 return array();
30 $pager = clone $this->pager;
31 $query = clone $this->query;
33 $query->setDisableOverheating(true);
35 $results = $query->executeWithCursorPager($pager);
37 // If we got less than a full page of results, this was the last set of
38 // results. Throw away the pager so we end iteration.
39 if (!$pager->getHasMoreResults()) {
40 $this->pager = null;
41 } else {
42 $this->pager->setAfterID($pager->getNextPageID());
45 return $results;