コード例 #1
0
 public function buildLimit(Fetcher $fetcher)
 {
     if (!$fetcher->hasLimit()) {
         return '';
     } else {
         $offset = ($fetcher->getPage() - 1) * $fetcher->getNbByPage();
         $sql = sprintf(" LIMIT %s OFFSET %s", $fetcher->getNbByPage(), $offset);
         return $sql;
     }
 }
コード例 #2
0
 public function buildLimit(Fetcher $fetcher)
 {
     $offset = null;
     $limit = null;
     if ($fetcher->hasLimit()) {
         $offset = ($fetcher->getPage() - 1) * $fetcher->getNbByPage();
         $limit = $fetcher->getNbByPage();
     }
     return array('offset' => $offset, 'limit' => $limit);
 }
コード例 #3
0
ファイル: FetcherIterator.php プロジェクト: evaneos/berthe
 private function reloadResults()
 {
     if ($this->lastId !== null) {
         if ($this->filterIdOperation === null) {
             $this->filterIdOperation = $this->fetcher->filterByGreaterThanId($this->lastId);
         } else {
             $this->filterIdOperation->setValue($this->lastId);
         }
     }
     $this->results = $this->fetchable->getByFetcher($this->fetcher)->getResultSet();
     if (!$this->fetcher->hasResults()) {
         $this->ended = true;
         $this->currentKey = null;
     } else {
         if ($this->fetcher->count() !== $this->fetcher->getNbByPage()) {
             $this->ended = true;
         }
         $this->currentKey = key($this->results);
         /** @var VO $vo */
         $vo = current($this->results);
         if ($vo !== false) {
             $this->lastId = $vo->getId();
         }
     }
 }