- Fixed a bug with the IN query
This commit is contained in:
parent
902167c2ed
commit
5ef20533b2
|
@ -110,11 +110,11 @@ class Where extends Fragment {
|
|||
protected function operator() : string
|
||||
{
|
||||
if ( is_array($this->value) ) {
|
||||
return (in_array($this->operator, [ '!=', '<>' ]) ? Where::CONDITION_NOT . " " : "") . Where::COMPARISON_IN;
|
||||
return Where::COMPARISON_IN;
|
||||
}
|
||||
|
||||
# whitelisting operators
|
||||
return in_array(strtoupper($this->operator), [ '=', '!=', '>', '>=', '<', '<=', '<>', 'LIKE', 'IS', 'IS NOT', 'REGEXP' ]) ? $this->operator : "=";
|
||||
return in_array(strtoupper($this->operator), [ '=', '!=', '>', '>=', '<', '<=', '<>', 'LIKE', 'IS', 'IS NOT', 'REGEXP', 'IN' ]) ? $this->operator : "=";
|
||||
}
|
||||
|
||||
protected function value()
|
||||
|
|
|
@ -95,14 +95,14 @@ trait ConditionTrait
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function in($field, $value, string $operator = Query\Where::OPERATOR_EQUAL) : self
|
||||
public function in($field, $value, string $operator = Query\Where::COMPARISON_IN) : self
|
||||
{
|
||||
$this->queryBuilder->where($field, $value, $operator);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function orIn($field, $value, string $operator = Query\Where::OPERATOR_EQUAL) : self
|
||||
public function orIn($field, $value, string $operator = Query\Where::COMPARISON_IN) : self
|
||||
{
|
||||
$this->queryBuilder->where($field, $value, $operator, Query\Where::CONDITION_OR);
|
||||
|
||||
|
@ -111,14 +111,14 @@ trait ConditionTrait
|
|||
|
||||
public function notIn($field, $value) : self
|
||||
{
|
||||
$this->queryBuilder->where($field, $value, Query\Where::OPERATOR_NOT_EQUAL);
|
||||
$this->queryBuilder->where($field, $value, Query\Where::COMPARISON_IN, true);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function orNotIn($field, $value) : self
|
||||
{
|
||||
return $this->orNot($field, $value, Query\Where::OPERATOR_NOT_EQUAL, Query\Where::CONDITION_OR, true);
|
||||
return $this->orNot($field, $value, Query\Where::COMPARISON_IN, Query\Where::CONDITION_OR, true);
|
||||
}
|
||||
|
||||
public function like($field, $value) : self
|
||||
|
|
Loading…
Reference in New Issue