Skip to content

Commit

Permalink
Merge pull request #34 from Icinga/put-reset-methods-into-the-traits
Browse files Browse the repository at this point in the history
Put reset methods into the traits
  • Loading branch information
nilmerg authored Jun 15, 2021
2 parents 34bde04 + e3c190b commit 66e503e
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 48 deletions.
14 changes: 14 additions & 0 deletions src/LimitOffset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -72,4 +79,11 @@ public function offset($offset)

return $this;
}

public function resetOffset()
{
$this->offset = null;

return $this;
}
}
14 changes: 14 additions & 0 deletions src/LimitOffsetInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -54,4 +61,11 @@ public function getOffset();
* @return $this
*/
public function offset($offset);

/**
* Reset the offset
*
* @return $this
*/
public function resetOffset();
}
7 changes: 7 additions & 0 deletions src/OrderBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
7 changes: 7 additions & 0 deletions src/OrderByInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
48 changes: 0 additions & 48 deletions src/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,42 +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 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
*
Expand All @@ -510,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
*
Expand Down
7 changes: 7 additions & 0 deletions src/Where.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
*
Expand Down
7 changes: 7 additions & 0 deletions src/WhereInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 66e503e

Please sign in to comment.