Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 47304e9

Browse files
committed
Keep all operators in Builder::$operators public variable
1 parent 08330fd commit 47304e9

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/Query/Builder.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ class Builder extends BaseBuilder
7777
'like',
7878
'not like',
7979
'between',
80+
'ilike',
8081
'&',
8182
'|',
8283
'^',
8384
'<<',
8485
'>>',
8586
'rlike',
87+
'regexp',
88+
'not regexp',
8689
'exists',
8790
'type',
8891
'mod',
@@ -113,7 +116,6 @@ class Builder extends BaseBuilder
113116
* @var array
114117
*/
115118
protected $conversion = [
116-
'=' => '=',
117119
'!=' => 'ne',
118120
'<>' => 'ne',
119121
'<' => 'lt',
@@ -123,7 +125,6 @@ class Builder extends BaseBuilder
123125
'regexp' => 'regex',
124126
'not regexp' => 'not regex',
125127
'ilike' => 'like',
126-
'not ilike' => 'not like',
127128
'elemmatch' => 'elemMatch',
128129
'geointersects' => 'geoIntersects',
129130
'geowithin' => 'geoWithin',
@@ -1068,6 +1069,7 @@ protected function compileWhereBasic(array $where): array
10681069
throw new \LogicException(sprintf('Missing expected starting delimiter in regular expression "%s", supported delimiters are: %s', $value, implode(' ', self::REGEX_DELIMITERS)));
10691070
}
10701071
$e = explode($delimiter, $value);
1072+
// We don't try to detect if the last delimiter is escaped. This would be an invalid regex.
10711073
if (count($e) < 3) {
10721074
throw new \LogicException(sprintf('Missing expected ending delimiter "%s" in regular expression "%s"', $delimiter, $value));
10731075
}
@@ -1078,7 +1080,7 @@ protected function compileWhereBasic(array $where): array
10781080
$value = new Regex($regstr, $flags);
10791081
}
10801082

1081-
// For inverse regex operations, we can just use the $not operatorwith the Regex
1083+
// For inverse regex operations, we can just use the $not operator with the Regex
10821084
$operator = $operator === 'regex' ? '=' : 'not';
10831085
}
10841086

@@ -1260,21 +1262,6 @@ protected function compileWhereRaw(array $where): mixed
12601262
return $where['sql'];
12611263
}
12621264

1263-
protected function invalidOperator($operator)
1264-
{
1265-
if (! is_string($operator)) {
1266-
return true;
1267-
}
1268-
1269-
$operator = strtolower($operator);
1270-
1271-
if (isset($this->conversion[$operator])) {
1272-
return false;
1273-
}
1274-
1275-
return parent::invalidOperator($operator);
1276-
}
1277-
12781265
/**
12791266
* Set custom options for the query.
12801267
*

0 commit comments

Comments
 (0)