Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ private function parseWhereColumnFirst(string $first): array
*
* @throws InvalidArgumentException
*/
public function whereBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function whereBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBWhere', $key, $values, false, 'AND ', $escape);
}
Expand All @@ -937,7 +937,7 @@ public function whereBetween(?string $key = null, $values = null, ?bool $escape
*
* @throws InvalidArgumentException
*/
public function orWhereBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function orWhereBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBWhere', $key, $values, false, 'OR ', $escape);
}
Expand All @@ -952,7 +952,7 @@ public function orWhereBetween(?string $key = null, $values = null, ?bool $escap
*
* @throws InvalidArgumentException
*/
public function whereNotBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function whereNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBWhere', $key, $values, true, 'AND ', $escape);
}
Expand All @@ -967,7 +967,7 @@ public function whereNotBetween(?string $key = null, $values = null, ?bool $esca
*
* @throws InvalidArgumentException
*/
public function orWhereNotBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function orWhereNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBWhere', $key, $values, true, 'OR ', $escape);
}
Expand All @@ -982,7 +982,7 @@ public function orWhereNotBetween(?string $key = null, $values = null, ?bool $es
*
* @throws InvalidArgumentException
*/
public function havingBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function havingBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBHaving', $key, $values, false, 'AND ', $escape);
}
Expand All @@ -997,7 +997,7 @@ public function havingBetween(?string $key = null, $values = null, ?bool $escape
*
* @throws InvalidArgumentException
*/
public function orHavingBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function orHavingBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBHaving', $key, $values, false, 'OR ', $escape);
}
Expand All @@ -1012,7 +1012,7 @@ public function orHavingBetween(?string $key = null, $values = null, ?bool $esca
*
* @throws InvalidArgumentException
*/
public function havingNotBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function havingNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBHaving', $key, $values, true, 'AND ', $escape);
}
Expand All @@ -1027,7 +1027,7 @@ public function havingNotBetween(?string $key = null, $values = null, ?bool $esc
*
* @throws InvalidArgumentException
*/
public function orHavingNotBetween(?string $key = null, $values = null, ?bool $escape = null): static
public function orHavingNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null): static
{
return $this->whereBetweenHaving('QBHaving', $key, $values, true, 'OR ', $escape);
}
Expand All @@ -1050,7 +1050,7 @@ public function orHavingNotBetween(?string $key = null, $values = null, ?bool $e
*
* @throws InvalidArgumentException
*/
private function whereBetweenHaving(string $qbKey, ?string $key = null, $values = null, bool $not = false, string $type = 'AND ', ?bool $escape = null): static
private function whereBetweenHaving(string $qbKey, ?string $key = null, ?array $values = null, bool $not = false, string $type = 'AND ', ?bool $escape = null): static
{
if ($key === null || $key === '') {
throw new InvalidArgumentException(sprintf('%s() expects $key to be a non-empty string', debug_backtrace(0, 2)[1]['function']));
Expand Down
16 changes: 8 additions & 8 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
* @method $this groupEnd()
* @method $this groupStart()
* @method $this having($key, $value = null, ?bool $escape = null)
* @method $this havingBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this havingBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this havingGroupEnd()
* @method $this havingGroupStart()
* @method $this havingIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this havingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
* @method $this havingNotBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this havingNotBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this havingNotIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this join(string $table, string $cond, string $type = '', ?bool $escape = null)
* @method $this like($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
Expand All @@ -68,11 +68,11 @@
* @method $this orderBy(string $orderBy, string $direction = '', ?bool $escape = null)
* @method $this orGroupStart()
* @method $this orHaving($key, $value = null, ?bool $escape = null)
* @method $this orHavingBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orHavingBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this orHavingGroupStart()
* @method $this orHavingIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orHavingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
* @method $this orHavingNotBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orHavingNotBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this orHavingNotIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
* @method $this orLikeAny(list<RawSql|string> $fields, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
Expand All @@ -81,11 +81,11 @@
* @method $this orNotHavingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
* @method $this orNotLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
* @method $this orWhere($key, $value = null, ?bool $escape = null)
* @method $this orWhereBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orWhereBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this orWhereColumn(string $first, string $second, ?bool $escape = null)
* @method $this orWhereExists($subquery)
* @method $this orWhereIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orWhereNotBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this orWhereNotBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this orWhereNotExists($subquery)
* @method $this orWhereNotIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this select($select = '*', ?bool $escape = null)
Expand All @@ -97,11 +97,11 @@
* @method $this when($condition, callable $callback, ?callable $defaultCallback = null)
* @method $this whenNot($condition, callable $callback, ?callable $defaultCallback = null)
* @method $this where($key, $value = null, ?bool $escape = null)
* @method $this whereBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this whereBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this whereColumn(string $first, string $second, ?bool $escape = null)
* @method $this whereExists($subquery)
* @method $this whereIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this whereNotBetween(?string $key = null, $values = null, ?bool $escape = null)
* @method $this whereNotBetween(?string $key = null, array<array-key, mixed>|null $values = null, ?bool $escape = null)
* @method $this whereNotExists($subquery)
* @method $this whereNotIn(?string $key = null, $values = null, ?bool $escape = null)
*
Expand Down
1 change: 0 additions & 1 deletion tests/system/Database/Builder/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public static function provideHavingBetweenInvalidValuesThrowInvalidArgumentExce
{
return [
'null' => [null],
'not array' => ['not array'],
'empty array' => [[]],
'one value' => [[10]],
'three values' => [[10, 20, 30]],
Expand Down
1 change: 0 additions & 1 deletion tests/system/Database/Builder/WhereTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,6 @@ public static function provideWhereBetweenInvalidValuesThrowInvalidArgumentExcep
{
return [
'null' => [null],
'not array' => ['not array'],
'empty array' => [[]],
'one value' => [['2026-01-01']],
'three values' => [
Expand Down
16 changes: 8 additions & 8 deletions user_guide_src/source/database/query_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ Class Reference
If ``$first`` does not end with a supported operator, ``=`` is used as the comparison operator.
Supported operators are ``=``, ``!=``, ``<>``, ``<``, ``>``, ``<=``, and ``>=``.

.. php:method:: whereBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: whereBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: Name of field to examine
:param array $values: Two values defining the inclusive range
Expand All @@ -1871,7 +1871,7 @@ Class Reference

Generates a ``WHERE`` field ``BETWEEN`` minimum and maximum value SQL query, joined with ``AND`` if appropriate.

.. php:method:: orWhereBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: orWhereBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: The field to search
:param array $values: Two values defining the inclusive range
Expand All @@ -1881,7 +1881,7 @@ Class Reference

Generates a ``WHERE`` field ``BETWEEN`` minimum and maximum value SQL query, joined with ``OR`` if appropriate.

.. php:method:: whereNotBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: whereNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: Name of field to examine
:param array $values: Two values defining the inclusive range
Expand All @@ -1891,7 +1891,7 @@ Class Reference

Generates a ``WHERE`` field ``NOT BETWEEN`` minimum and maximum value SQL query, joined with ``AND`` if appropriate.

.. php:method:: orWhereNotBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: orWhereNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: The field to search
:param array $values: Two values defining the inclusive range
Expand Down Expand Up @@ -2100,7 +2100,7 @@ Class Reference

Adds a ``HAVING`` clause to a query, separating multiple calls with ``OR``.

.. php:method:: havingBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: havingBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: Name of field to examine
:param array $values: Two values defining the inclusive range
Expand All @@ -2110,7 +2110,7 @@ Class Reference

Generates a ``HAVING`` field ``BETWEEN`` minimum and maximum value SQL query, joined with ``AND`` if appropriate.

.. php:method:: orHavingBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: orHavingBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: The field to search
:param array $values: Two values defining the inclusive range
Expand All @@ -2120,7 +2120,7 @@ Class Reference

Generates a ``HAVING`` field ``BETWEEN`` minimum and maximum value SQL query, joined with ``OR`` if appropriate.

.. php:method:: havingNotBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: havingNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: Name of field to examine
:param array $values: Two values defining the inclusive range
Expand All @@ -2130,7 +2130,7 @@ Class Reference

Generates a ``HAVING`` field ``NOT BETWEEN`` minimum and maximum value SQL query, joined with ``AND`` if appropriate.

.. php:method:: orHavingNotBetween([$key = null[, $values = null[, $escape = null]]])
.. php:method:: orHavingNotBetween(?string $key = null, ?array $values = null, ?bool $escape = null)

:param string $key: The field to search
:param array $values: Two values defining the inclusive range
Expand Down
Loading