Skip to content

Commit e045fab

Browse files
GromNaNalcaeus
authored andcommitted
PHPORM-49 Implement Query\Builder::whereNot by encapsulating into $not (#13) (#15)
`Query\Builder::whereNot` was simply ignoring the "not" and breaking the built query.
1 parent 7852778 commit e045fab

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
1010
- Throw an exception for unsupported `Query\Builder` methods [#9](https://github.com/GromNaN/laravel-mongodb-private/pull/9) by [@GromNaN](https://github.com/GromNaN).
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).
13+
- Remove public property `Query\Builder::$paginating` [#15](https://github.com/GromNaN/laravel-mongodb-private/pull/15) by [@GromNaN](https://github.com/GromNaN).
1314

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

Diff for: src/Query/Builder.php

-17
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ class Builder extends BaseBuilder
5959
*/
6060
public $options = [];
6161

62-
/**
63-
* Indicate if we are executing a pagination query.
64-
*
65-
* @var bool
66-
*/
67-
public $paginating = false;
68-
6962
/**
7063
* All of the available clause operators.
7164
*
@@ -574,16 +567,6 @@ public function whereBetween($column, iterable $values, $boolean = 'and', $not =
574567
return $this;
575568
}
576569

577-
/**
578-
* @inheritdoc
579-
*/
580-
public function forPage($page, $perPage = 15)
581-
{
582-
$this->paginating = true;
583-
584-
return $this->skip(($page - 1) * $perPage)->take($perPage);
585-
}
586-
587570
/**
588571
* @inheritdoc
589572
*/

Diff for: tests/Query/BuilderTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ public static function provideQueryBuilderToMql(): iterable
247247
]),
248248
];
249249

250+
/** @see DatabaseQueryBuilderTest::testForPage() */
251+
yield 'forPage' => [
252+
['find' => [[], ['limit' => 20, 'skip' => 40]]],
253+
fn (Builder $builder) => $builder->forPage(3, 20),
254+
];
255+
250256
/** @see DatabaseQueryBuilderTest::testOrderBys() */
251257
yield 'orderBy multiple columns' => [
252258
['find' => [[], ['sort' => ['email' => 1, 'age' => -1]]]],

0 commit comments

Comments
 (0)