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

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

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2019

Should probably target master since the method signature changes.

@BrandonSurowiec

This comment has been minimized.

Copy link
Contributor

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

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@devcircus

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

How is this not a breaking change?

@devcircus

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

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

@hotmeteor

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

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

@staudenmeir

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

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

@devcircus

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2019

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
Projects
None yet
8 participants
You can’t perform that action at this time.