Skip to content
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

[5.4] Support Arrayable objects in Eloquent's whereKey method #17812

Merged
merged 3 commits into from
Feb 10, 2017
Merged

[5.4] Support Arrayable objects in Eloquent's whereKey method #17812

merged 3 commits into from
Feb 10, 2017

Conversation

andyvenus
Copy link
Contributor

@andyvenus andyvenus commented Feb 7, 2017

Currently, passing a Collection or other Arrayable class to whereKey results in an error.

As findMany makes use of whereKey internally, it is also affected (in <5.4 collections worked with findMany).

This adds a check for Arrayable objects in whereKey.

@@ -190,7 +191,7 @@ public function when($value, $callback, $default = null)
*/
public function whereKey($id)
{
if (is_array($id)) {
if (is_array($id) || $id instanceof Arrayable) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, tests added

@taylorotwell taylorotwell merged commit 87b37c9 into laravel:5.4 Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants