feat(database): add support for whereHas and whereDoesntHave#2081
Merged
brendt merged 5 commits intotempestphp:3.xfrom Mar 31, 2026
Merged
feat(database): add support for whereHas and whereDoesntHave#2081brendt merged 5 commits intotempestphp:3.xfrom
whereHas and whereDoesntHave#2081brendt merged 5 commits intotempestphp:3.xfrom
Conversation
Add WhereConnector enum for AND/OR logical connectors in WHERE clauses. Add WhereExistsStatement for compiling EXISTS/NOT EXISTS subqueries and COUNT(*) subqueries with operator/count support.
Add HasWhereRelationMethods trait with whereHas, whereDoesntHave, orWhereHas, and orWhereDoesntHave. Supports HasMany, BelongsTo, and HasOne relations with optional callback constraints, nested dot-notation relations, and COUNT(*) subqueries via operator/count parameters. Update SelectStatement and UpdateStatement to accept WhereExistsStatement in their WHERE clause type unions.
30 tests covering SQL compilation, integration with real data, nested dot-notation relations, count-based filtering, callback constraints, and whereHas on count/delete/update query builders.
eee9897 to
c24a26d
Compare
Benchmark ResultsComparison of Open to see the benchmark resultsNo benchmark changes above ±5%. Generated by phpbench against commit e824fb6 |
Document relation filtering with whereHas, whereDoesntHave, callback constraints, count-based filtering, nested dot-notation, and usage across select/count/delete/update query builders.
Align whereHas/orWhereHas operator parameter with the existing convention used by whereField and orWhere.
c24a26d to
e824fb6
Compare
whereHas and whereDoesntHave
brendt
approved these changes
Mar 31, 2026
Member
|
Solid 👌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.