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); }
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; } }