Merge branch 'master' into feat/limit-offset-arg2

This commit is contained in:
Victor Westerlund 2024-01-12 13:23:42 +01:00 committed by GitHub
commit b5eadae76b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -150,7 +150,7 @@
return $this; return $this;
} }
// Return SQL LIMIT string from integer or array of [offset => limit] // SQL LIMIT string
public function limit(?int $limit, ?int $offset = null): self { public function limit(?int $limit, ?int $offset = null): self {
// Unset row limit if null was passed // Unset row limit if null was passed
if ($limit === null) { if ($limit === null) {
@ -158,6 +158,12 @@
return $this; return $this;
} }
// Set LIMIT without range directly as integer
if (is_int($limit)) {
$this->limit = $limit;
return $this;
}
// No offset defined, set limit property directly as string // No offset defined, set limit property directly as string
if (is_null($offset)) { if (is_null($offset)) {
$this->limit = (string) $limit; $this->limit = (string) $limit;