Skip to content

Conversation

@jessevz
Copy link
Contributor

@jessevz jessevz commented Dec 11, 2025

closes #1832

@jessevz jessevz requested review from Copilot and s3inlc December 17, 2025 12:43
@jessevz jessevz marked this pull request as ready for review December 17, 2025 12:44
Copy link

Copilot AI left a 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 CoalesceOrderFilter class 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.

}

function setJoinType($joinType) {
return $this->joinType = $joinType;
Copy link

Copilot AI Dec 17, 2025

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.

Suggested change
return $this->joinType = $joinType;
$this->joinType = $joinType;
return $this;

Copilot uses AI. Check for mistakes.
@jessevz jessevz marked this pull request as draft December 17, 2025 17:15
@jessevz jessevz marked this pull request as ready for review December 18, 2025 15:23
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