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

[11.x] Fix double negative in whereNotMorphedTo() query #54902

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

owenvoke
Copy link
Contributor

@owenvoke owenvoke commented Mar 5, 2025

This resolves an issue with the whereNotMorphedTo() method where the query results in a double negative. This changes to a format that resembles the previous logic.

This issue was introduced in a previous PR (see my comment).

Previous Logic (<11.40)

select *
from `posts`
where not (`posts`.`author_type` <=> 'user' and `posts`.`author_id` <=> 1)

Current logic (>=11.40)

select *
from `posts`
where not ((`posts`.`author_type` <=> 'user' and `posts`.`author_id` not in (1)))

Updated logic (this PR)

This logic aligns more with the previous logic, which does not have a double negative.

select *
from `posts`
where not ((`posts`.`author_type` <=> 'user' and `posts`.`author_id` in (1)))

This resolves an issue with the `whereNotMorphedTo()` method where
the query results in a double negative. This changes to a format
that resembles the previous logic.
@owenvoke owenvoke force-pushed the bugfix/where-not-morphed-to branch from 7786cf4 to 0f3eb4f Compare March 5, 2025 11:55
@taylorotwell taylorotwell merged commit 3bc6805 into laravel:11.x Mar 5, 2025
44 checks passed
@owenvoke owenvoke deleted the bugfix/where-not-morphed-to branch March 5, 2025 16:36
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.

None yet

2 participants