Add SQL expression to Sort config
Open
Nobody has claimed this yet.
type:enhancement
- Dominant language
- PHP
- Stars
- 14
- Forks
- 3
- Avg merge
- 1h 6m
- Merged PRs (30d)
- 1
Description
Proposed new feature or change
Add the ability to provide array|string|ExpressionInterface as the sort direction, which will be used as a parameter for Query::orderBy().
'name' => [
'asc' => new Expression("(substring(name, '^[0-9]+'))::int ASC, lower(name) ASC, LENGTH(name) ASC, split_part(name, '/', 2) ASC"),
'desc' => new Expression("(substring(name, '^[0-9]+'))::int DESC, lower(name) DESC, LENGTH(name) DESC, split_part(name, '/', 2) DESC"),
],
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Sort configuration and the call to Query::orderBy(), then inspect how ascending and descending values are currently handled. The change is done when array, string, and ExpressionInterface sort values can be passed through for both directions and the existing database sorting behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100