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

PHPORM-63 Remove unused public property Query\Builder::$paginating #15

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message would benefit from noting that this is being removed as well.

Does the base class' forPage() method do the same thing?

Copy link
Owner Author

@GromNaN GromNaN Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the parent method is exactly the same, except for the $paginating property. So removing the method overload doesn't change anything.

{
$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