Skip to content

[12.x] Add WhereNotAny, WhereNotAll methods to Query Builder #55291

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

Closed
wants to merge 1 commit into from

Conversation

ezequidias
Copy link

@ezequidias ezequidias commented Apr 6, 2025

This PR introduces new methods to the Query Builder and refactors existing ones to enhance consistency and clarity:

  • whereNotAny: Adds a "where not" clause for multiple columns with "or" conditions between them.
  • orWhereNotAny: Adds an "or where not" clause for multiple columns with "or" conditions between them.
  • whereNotAll: Adds a "where not" clause for multiple columns with "and" conditions between them.
  • orWhereNotAll: Adds an "or where not" clause for multiple columns with "and" conditions between them.

Additionally, the previously existing methods whereNone and orWhereNone have been refactored to serve as aliases for whereNotAny and orWhereNotAny, respectively. This change addresses concerns regarding the naming inconsistency and potential confusion associated with the whereNone method, as discussed in PR #52383.​

The whereNone method's naming did not align with Laravel's established conventions, leading to potential confusion among developers. By introducing whereNotAny and whereNotAll, we adhere to a more intuitive and consistent naming pattern, enhancing code readability and maintainability. This approach also aligns with the enhancements proposed in PR #52361, ensuring a comprehensive and logical set of query builder methods.

To maintain backward compatibility, whereNone and orWhereNone have been retained as aliases. However, it is recommended that these methods be deprecated in future Laravel releases to encourage developers to adopt the more appropriately named methods.

@ezequidias ezequidias changed the title [12.x] Add WhereNotAny, WhereNotAll methods to Laravel Query Builder [12.x] Add WhereNotAny, WhereNotAll methods to Query Builder Apr 6, 2025
@ezequidias ezequidias marked this pull request as draft April 6, 2025 07:08
@ezequidias ezequidias marked this pull request as ready for review April 7, 2025 14:09
@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

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.

2 participants