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

Commit 56d9da8

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

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/Query/Builder.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,16 @@ class Builder extends BaseBuilder
7777
'like',
7878
'not like',
7979
'between',
80+
'ilike',
81+
'not ilike',
8082
'&',
8183
'|',
8284
'^',
8385
'<<',
8486
'>>',
8587
'rlike',
88+
'regexp',
89+
'not regexp',
8690
'exists',
8791
'type',
8892
'mod',
@@ -113,7 +117,6 @@ class Builder extends BaseBuilder
113117
* @var array
114118
*/
115119
protected $conversion = [
116-
'=' => '=',
117120
'!=' => 'ne',
118121
'<>' => 'ne',
119122
'<' => 'lt',
@@ -1068,6 +1071,7 @@ protected function compileWhereBasic(array $where): array
10681071
throw new \LogicException(sprintf('Missing expected starting delimiter in regular expression "%s", supported delimiters are: %s', $value, implode(' ', self::REGEX_DELIMITERS)));
10691072
}
10701073
$e = explode($delimiter, $value);
1074+
// We don't try to detect if the last delimiter is escaped. This would be an invalid regex.
10711075
if (count($e) < 3) {
10721076
throw new \LogicException(sprintf('Missing expected ending delimiter "%s" in regular expression "%s"', $delimiter, $value));
10731077
}
@@ -1078,7 +1082,7 @@ protected function compileWhereBasic(array $where): array
10781082
$value = new Regex($regstr, $flags);
10791083
}
10801084

1081-
// For inverse regex operations, we can just use the $not operatorwith the Regex
1085+
// For inverse regex operations, we can just use the $not operator with the Regex
10821086
$operator = $operator === 'regex' ? '=' : 'not';
10831087
}
10841088

@@ -1260,21 +1264,6 @@ protected function compileWhereRaw(array $where): mixed
12601264
return $where['sql'];
12611265
}
12621266

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-
12781267
/**
12791268
* Set custom options for the query.
12801269
*

0 commit comments

Comments
 (0)