-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PHPORM-209 Add query builder helper to set read preference #3244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -113,6 +114,8 @@ class Builder extends BaseBuilder | |||
*/ | |||
public $hint; | |||
|
|||
private ReadPreference $readPreference; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why other properties are public. Using private by default to not add the new property to the API for no reason.
* | ||
* @return $this | ||
*/ | ||
public function readPreference(string $mode, ?array $tagSets = null, ?array $options = null): static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to confirm that you don't need the ability to clear a ReadPreference previously assigned to the builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the operations using the query builder cannot be unset.
For this config, it's still possible to overwrite with an other read preference.
|
||
yield 'timeout' => [ | ||
['find' => [[], ['maxTimeMS' => 2345]]], | ||
fn (Builder $builder) => $builder->timeout(2.3456), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted that this tests integer truncation.
Fix PHPORM-209
Query\Builder::readPreference()
to set the read preference option for find and aggregate.Checklist