Skip to content

Commit

Permalink
QueryBuilder: add optional offset param to limit method
Browse files Browse the repository at this point in the history
  • Loading branch information
donwilson committed Nov 1, 2023
1 parent fa52fcc commit f679e83
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Magnetar/Database/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,17 @@ public function unsetOrderBy(): self {

/**
* Set the limit
* @param int $limit
* @param int $limit The number of rows to return
* @param int|null $offset Optional. The offset to start at. Defaults to null (do not alter offset)
* @return self
*/
public function limit(int $limit): self {
public function limit(int $limit, int|null $offset=null): self {
$this->limit = $limit;

if(null !== $offset) {
return $this->offset($offset);
}

return $this;
}

Expand Down

0 comments on commit f679e83

Please sign in to comment.