Skip to content

feat(database): add support for whereHas and whereDoesntHave#2081

Merged
brendt merged 5 commits intotempestphp:3.xfrom
laylatichy:feat-add-where-has-helpers
Mar 31, 2026
Merged

feat(database): add support for whereHas and whereDoesntHave#2081
brendt merged 5 commits intotempestphp:3.xfrom
laylatichy:feat-add-where-has-helpers

Conversation

@laylatichy
Copy link
Copy Markdown
Contributor

No description provided.

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.
@laylatichy laylatichy force-pushed the feat-add-where-has-helpers branch from eee9897 to c24a26d Compare March 27, 2026 18:49
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

Benchmark Results

Comparison of feat-add-where-has-helpers against 3.x (7334926688b074d0f93e75b701c511dffc8106dd).

Open to see the benchmark results

No benchmark changes above ±5%.

Generated by phpbench against commit e824fb6

@laylatichy laylatichy marked this pull request as ready for review March 27, 2026 19:00
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.
@laylatichy laylatichy force-pushed the feat-add-where-has-helpers branch from c24a26d to e824fb6 Compare March 27, 2026 19:14
@innocenzi innocenzi changed the title feat(database): add support for wherehas and wheredoesnthave feat(database): add support for whereHas and whereDoesntHave Mar 27, 2026
@brendt
Copy link
Copy Markdown
Member

brendt commented Mar 31, 2026

Solid 👌

@brendt brendt merged commit 5469e01 into tempestphp:3.x Mar 31, 2026
77 checks passed
regnerisch pushed a commit to regnerisch/tempest-framework that referenced this pull request Mar 31, 2026
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