Closed VinceG closed 3 years ago
Looks like the tests are failing but not related to this PR.
I re-ran the tests so that the credentials work properly (sorry for the inconvenience on that).
It seems like there are some PHPStan errors that make the CI fail, but this is unexpected. There's an issue on the PHPStan repo that describes the same situation we're encountering. We have to wait until this commit is released, or ignore the errors for now through the phpstan.neon.dist
file.
@VinceG Let's unblock this, and ignore the PHPStan errors for now. I'll make sure keep track of this in the coming days/weeks.
Can you please ignore the errors for now by adding the following to the phpstan.neon.dist
file, under the ignoreErrors
key? Thank you in advance!
- '#Cannot call method withScoutMetadata\(\) on class-string\|object.#'
- '#Cannot call method getScoutKey\(\) on class-string\|object.#'
- '#Cannot call method toSearchableArray\(\) on class-string\|object.#'
@DevinCodes Done.
This fix is released in v1.14.0
🎉
Thank you again for your contribution!
Describe your change
This will add an empty condition to the whereIn method to make sure it'll add the condition only if the array is not empty. if it's empty it'll add a false condition to make sure the condition will stop ALL records from being returned.
What problem is this fixing?
Originally passing an empty array to
whereIn
resulted in ignoring the entire condition, this results in unexpected search results where a user might see more results than they should.For example
With this fix, it'll do exactly what Laravel does with its query builder where if the array is empty it'll append a false condition.
added a corresponding test to make sure everything passes with this change.