Skip to content

Commit

Permalink
PHPORM-49 Implement Query\Builder::whereNot by encapsulating into `…
Browse files Browse the repository at this point in the history
…$not` (mongodb#13) (mongodb#15)

`Query\Builder::whereNot` was simply ignoring the "not" and breaking the built query.
  • Loading branch information
GromNaN committed Jul 20, 2023
1 parent 9d9c7c8 commit 52c0ea3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Throw an exception for unsupported `Query\Builder` methods [#9](https://github.com/GromNaN/laravel-mongodb-private/pull/9) by [@GromNaN](https://github.com/GromNaN).
- 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).
- 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).
- Remove public property `Query\Builder::$paginating` [#15](https://github.com/GromNaN/laravel-mongodb-private/pull/15) by [@GromNaN](https://github.com/GromNaN).

## [3.9.2] - 2022-09-01

Expand Down
17 changes: 0 additions & 17 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ class Builder extends BaseBuilder
*/
public $options = [];

/**
* Indicate if we are executing a pagination query.
*
* @var bool
*/
public $paginating = false;

/**
* All of the available clause operators.
*
Expand Down Expand Up @@ -574,16 +567,6 @@ public function whereBetween($column, iterable $values, $boolean = 'and', $not =
return $this;
}

/**
* @inheritdoc
*/
public function forPage($page, $perPage = 15)
{
$this->paginating = true;

return $this->skip(($page - 1) * $perPage)->take($perPage);
}

/**
* @inheritdoc
*/
Expand Down
6 changes: 6 additions & 0 deletions tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ public static function provideQueryBuilderToMql(): iterable
]),
];

/** @see DatabaseQueryBuilderTest::testForPage() */
yield 'forPage' => [
['find' => [[], ['limit' => 20, 'skip' => 40]]],
fn (Builder $builder) => $builder->forPage(3, 20),
];

/** @see DatabaseQueryBuilderTest::testOrderBys() */
yield 'orderBy multiple columns' => [
['find' => [[], ['sort' => ['email' => 1, 'age' => -1]]]],
Expand Down

0 comments on commit 52c0ea3

Please sign in to comment.