From 59066c7286cce0bd1ee3c9c8fe3b55b58d6c0ff5 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 11 Jun 2021 14:58:48 +0200 Subject: [PATCH 1/3] LimitOffset: Add methods `resetLimit()` and `resetOffset()` --- src/LimitOffset.php | 14 ++++++++++++++ src/LimitOffsetInterface.php | 14 ++++++++++++++ src/Select.php | 24 ------------------------ 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/LimitOffset.php b/src/LimitOffset.php index f6b6579..99c30a2 100644 --- a/src/LimitOffset.php +++ b/src/LimitOffset.php @@ -49,6 +49,13 @@ public function limit($limit) return $this; } + public function resetLimit() + { + $this->limit = null; + + return $this; + } + public function hasOffset() { return $this->offset !== null; @@ -72,4 +79,11 @@ public function offset($offset) return $this; } + + public function resetOffset() + { + $this->offset = null; + + return $this; + } } diff --git a/src/LimitOffsetInterface.php b/src/LimitOffsetInterface.php index 87f5073..94628c4 100644 --- a/src/LimitOffsetInterface.php +++ b/src/LimitOffsetInterface.php @@ -31,6 +31,13 @@ public function getLimit(); */ public function limit($limit); + /** + * Reset the limit + * + * @return $this + */ + public function resetLimit(); + /** * Get whether an offset is configured * @@ -54,4 +61,11 @@ public function getOffset(); * @return $this */ public function offset($offset); + + /** + * Reset the offset + * + * @return $this + */ + public function resetOffset(); } diff --git a/src/Select.php b/src/Select.php index 925b600..5429fa8 100644 --- a/src/Select.php +++ b/src/Select.php @@ -474,30 +474,6 @@ public function resetOrderBy() return $this; } - /** - * Reset the limit of the query - * - * @return $this - */ - public function resetLimit() - { - $this->limit = null; - - return $this; - } - - /** - * Reset the offset of the query - * - * @return $this - */ - public function resetOffset() - { - $this->offset = null; - - return $this; - } - /** * Reset queries combined with UNION and UNION ALL * From 9fd567c3d5505cb18820da4b08a4eee55cf78716 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 11 Jun 2021 14:59:22 +0200 Subject: [PATCH 2/3] OrderBy: Add method `resetOrderBy()` --- src/OrderBy.php | 7 +++++++ src/OrderByInterface.php | 7 +++++++ src/Select.php | 12 ------------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/OrderBy.php b/src/OrderBy.php index efa1a67..0721ad5 100644 --- a/src/OrderBy.php +++ b/src/OrderBy.php @@ -48,6 +48,13 @@ public function orderBy($orderBy, $direction = null) return $this; } + public function resetOrderBy() + { + $this->orderBy = null; + + return $this; + } + /** * Clone the properties provided by this trait * diff --git a/src/OrderByInterface.php b/src/OrderByInterface.php index 6a84683..9cce3d0 100644 --- a/src/OrderByInterface.php +++ b/src/OrderByInterface.php @@ -41,4 +41,11 @@ public function getOrderBy(); * @return $this */ public function orderBy($orderBy, $direction = null); + + /** + * Reset the ORDER BY part of the query + * + * @return $this + */ + public function resetOrderBy(); } diff --git a/src/Select.php b/src/Select.php index 5429fa8..3dd1616 100644 --- a/src/Select.php +++ b/src/Select.php @@ -462,18 +462,6 @@ public function resetHaving() return $this; } - /** - * Reset the ORDER BY part of the query - * - * @return $this - */ - public function resetOrderBy() - { - $this->orderBy = null; - - return $this; - } - /** * Reset queries combined with UNION and UNION ALL * From e3c190bf04f7a61bdfb4be03439e60f2bc31b24f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 11 Jun 2021 14:59:52 +0200 Subject: [PATCH 3/3] Where: Add method `resetWhere()` --- src/Select.php | 12 ------------ src/Where.php | 7 +++++++ src/WhereInterface.php | 7 +++++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Select.php b/src/Select.php index 3dd1616..77a50ee 100644 --- a/src/Select.php +++ b/src/Select.php @@ -474,18 +474,6 @@ public function resetUnion() return $this; } - /** - * Reset the WHERE part of the query - * - * @return $this - */ - public function resetWhere() - { - $this->where = null; - - return $this; - } - /** * Get the count query * diff --git a/src/Where.php b/src/Where.php index 4cda175..f862846 100644 --- a/src/Where.php +++ b/src/Where.php @@ -47,6 +47,13 @@ public function orNotWhere($condition, ...$args) return $this; } + public function resetWhere() + { + $this->where = null; + + return $this; + } + /** * Make $condition an array and build an array like this: [$operator, [$condition]] * diff --git a/src/WhereInterface.php b/src/WhereInterface.php index 8a0a9c4..e724465 100644 --- a/src/WhereInterface.php +++ b/src/WhereInterface.php @@ -74,4 +74,11 @@ public function notWhere($condition, ...$args); * @return $this */ public function orNotWhere($condition, ...$args); + + /** + * Reset the WHERE part of the query + * + * @return $this + */ + public function resetWhere(); }