-
Notifications
You must be signed in to change notification settings - Fork 248
Made it possible to sort on 1 to 1 relationship attributes #1833
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
base: dev
Are you sure you want to change the base?
Conversation
…nd filtering on joins
…taskwrappername or taskname
…pers to handle the unconventional relation between taskwrapper and task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enables sorting on attributes from 1-to-1 relationships in the API, addressing issue #1832. The implementation extends the existing query filter and join infrastructure to support relationship-based sorting through dot notation (e.g., task.name).
Key changes:
- Extended join filtering to support configurable join types (LEFT, INNER) and conditional query filters on joins
- Modified order filter templates to parse relationship attributes using dot notation and create appropriate join filters
- Added a new
CoalesceOrderFilterclass to handle special ordering cases where multiple columns need to be coalesced
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
taskwrappers.routes.php |
Adds task as a 1-to-1 relationship and implements custom filter parsing logic to handle taskwrapper-to-task relationships with COALESCE ordering |
AbstractModelAPI.class.php |
Updates cursor calculation and resource fetching to support join filters when sorting on relationship attributes |
AbstractBaseAPI.class.php |
Moves relationship methods from AbstractModelAPI, adds support for parsing relationship-based sort parameters with dot notation |
init.php |
Includes the new CoalesceOrderFilter class in the initialization sequence |
OrderFilter.class.php |
Adds getter methods for accessing the 'by' and 'type' properties |
JoinFilter.class.php |
Extends join functionality with configurable join types and query filters that can be applied to join conditions |
Join.class.php |
Defines abstract methods for join type and query filters to enforce implementation in subclasses |
CoalesceOrderFilter.class.php |
New class implementing COALESCE-based ordering for handling multiple column fallbacks in sort operations |
AbstractModelFactory.class.php |
Implements support for different join types and applies query filters to join conditions in SQL generation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/dba/JoinFilter.class.php
Outdated
| } | ||
|
|
||
| function setJoinType($joinType) { | ||
| return $this->joinType = $joinType; |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setJoinType method has an incorrect return statement. It should return void or the object itself for method chaining, but currently it returns the assignment result. The return statement should be removed or changed to 'return $this;' for method chaining.
| return $this->joinType = $joinType; | |
| $this->joinType = $joinType; | |
| return $this; |
closes #1832