Skip to content

Commit 8d05d85

Browse files
authored
Merge pull request #56 from ensi-platform/v7-ecs-740
add orWhereIn
2 parents e673de6 + 01bd059 commit 8d05d85

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/Concerns/DecoratesBoolQuery.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public function whereIn(string $field, array|Arrayable $values): static
5151
return $this;
5252
}
5353

54+
public function orWhereIn(string $field, array|Arrayable $values): static
55+
{
56+
$this->forwardCallTo($this->boolQuery(), __FUNCTION__, func_get_args());
57+
58+
return $this;
59+
}
60+
5461
public function whereNotIn(string $field, array|Arrayable $values): static
5562
{
5663
$this->forwardCallTo($this->boolQuery(), __FUNCTION__, func_get_args());

src/Contracts/BoolQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public function whereNot(string $field, mixed $value): static;
1313

1414
public function whereIn(string $field, array|Arrayable $values): static;
1515

16+
public function orWhereIn(string $field, array|Arrayable $values): static;
17+
1618
public function whereNotIn(string $field, array|Arrayable $values): static;
1719

1820
public function whereHas(string $nested, Closure $filter): static;

src/Filtering/BoolQueryBuilder.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ public function whereIn(string $field, array|Arrayable $values): static
117117
return $this;
118118
}
119119

120+
public function orWhereIn(string $field, array|Arrayable $values): static
121+
{
122+
$this->should->add(new Terms($this->absolutePath($field), $values));
123+
124+
return $this;
125+
}
126+
120127
public function whereNotIn(string $field, array|Arrayable $values): static
121128
{
122129
$this->mustNot->add(new Terms($this->absolutePath($field), $values));

0 commit comments

Comments
 (0)