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.8] allow whereNull and whereNotNull to accept array columns argument #29154

Merged

Conversation

ninjaparade
Copy link
Contributor

@ninjaparade ninjaparade commented Jul 12, 2019

This PR adds the ability to pass an array of columns to the for whereNull and whereNotNull queries.

an example of the use case,

Before

$query->whereNull('id')->whereNull('expires_at');
$query->whereNotNull('id')->whereNotNull('expires_at');

After

$query->whereNull(['id', 'expires_at']);
$query->whereNotNull(['id', 'expires_at']);

I love changes

and let's face it, who doesn't?

@ninjaparade ninjaparade changed the title allow whereNull to accept array columns argument allow whereNull and whereNotNull to accept array columns argument Jul 12, 2019
src/Illuminate/Database/Query/Builder.php Outdated Show resolved Hide resolved
@ninjaparade ninjaparade changed the title allow whereNull and whereNotNull to accept array columns argument [5.8] allow whereNull and whereNotNull to accept array columns argument Jul 12, 2019
@koenhoeijmakers
Copy link
Contributor

Should probably target master since the method signature changes.

@BrandonSurowiec
Copy link
Contributor

BrandonSurowiec commented Jul 13, 2019

It isn't a breaking change in this case so 5.8 is fine. Nice idea!

@taylorotwell taylorotwell merged commit 0a1a5eb into laravel:5.8 Jul 13, 2019
@devcircus
Copy link
Contributor

How is this not a breaking change?

@devcircus
Copy link
Contributor

Probably rare but if you're overriding whereNull, your app will blow up after this change.

@hotmeteor
Copy link
Contributor

hotmeteor commented Jul 14, 2019

If you’re overriding whereNull then you’re already aware of what you intend to pass into it.

@staudenmeir
Copy link
Contributor

@devcircus The method signature didn't change, only the PHPDoc and the parameter name. This doesn't affect methods overriding whereNull().

@devcircus
Copy link
Contributor

learned something today. i've never once attempted to change the name of a parameter when overriding. Always assumed the names were as much a part of the signature as the types. Thanks @staudenmeir

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.

8 participants