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

Commit c76bcb8

Browse files
committed
PHPORM-64 Remove Query\Builder::whereAll
1 parent 52c0ea3 commit c76bcb8

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
1111
- Throw an exception when `Query\Builder::orderBy()` is used with invalid direction [#7](https://github.com/GromNaN/laravel-mongodb-private/pull/7) by [@GromNaN](https://github.com/GromNaN).
1212
- Throw an exception when `Query\Builder::push()` is used incorrectly [#5](https://github.com/GromNaN/laravel-mongodb-private/pull/5) by [@GromNaN](https://github.com/GromNaN).
1313
- Remove public property `Query\Builder::$paginating` [#15](https://github.com/GromNaN/laravel-mongodb-private/pull/15) by [@GromNaN](https://github.com/GromNaN).
14+
- Remove `Query\Builder::whereAll($column, $values)`. Use `Query\Builder::where($column, 'all', $values)` instead. [#16](https://github.com/GromNaN/laravel-mongodb-private/pull/16) by [@GromNaN](https://github.com/GromNaN).
1415

1516
## [3.9.2] - 2022-09-01
1617

src/Query/Builder.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -528,24 +528,6 @@ public function orderBy($column, $direction = 'asc')
528528
return $this;
529529
}
530530

531-
/**
532-
* Add a "where all" clause to the query.
533-
*
534-
* @param string $column
535-
* @param array $values
536-
* @param string $boolean
537-
* @param bool $not
538-
* @return $this
539-
*/
540-
public function whereAll($column, array $values, $boolean = 'and', $not = false)
541-
{
542-
$type = 'all';
543-
544-
$this->wheres[] = compact('column', 'type', 'boolean', 'values', 'not');
545-
546-
return $this;
547-
}
548-
549531
/**
550532
* @inheritdoc
551533
* @param list{mixed, mixed}|CarbonPeriod $values
@@ -1038,17 +1020,6 @@ protected function compileWheres(): array
10381020
return $compiled;
10391021
}
10401022

1041-
/**
1042-
* @param array $where
1043-
* @return array
1044-
*/
1045-
protected function compileWhereAll(array $where): array
1046-
{
1047-
extract($where);
1048-
1049-
return [$column => ['$all' => array_values($values)]];
1050-
}
1051-
10521023
/**
10531024
* @param array $where
10541025
* @return array

tests/Query/BuilderTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ public static function provideQueryBuilderToMql(): iterable
247247
]),
248248
];
249249

250+
yield 'where all' => [
251+
['find' => [['tags' => ['$all' => ['ssl', 'security']]], []]],
252+
fn (Builder $builder) => $builder->where('tags', 'all', ['ssl', 'security']),
253+
];
254+
250255
/** @see DatabaseQueryBuilderTest::testForPage() */
251256
yield 'forPage' => [
252257
['find' => [[], ['limit' => 20, 'skip' => 40]]],

0 commit comments

Comments
 (0)