Skip to content
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

FEAT add sortByField and remove mysql specific code from DataList #11588

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

lekoala
Copy link
Contributor

@lekoala lekoala commented Jan 31, 2025

Description

This is an alternative proposal to #11509

This is based on the work of @LennyObez with some improvements (avoid hardcoded 999, don't escape integer)

Manual testing steps

Create and populate two DataObjects that have a many_many relation between them
Perform an eagerLoad on DataObject::get() and convert the result to an array
Observe that the new sortByField method is used

Issues

#11503

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

@GuySartorelli
Copy link
Member

Looks great at a glance, thanks!
Can you please update the commit message to use the correct prefix (probably NEW) as per the commit message guidelines? It might also be appropriate to add Lenny as a co-author if you'd like to.

I'll review this properly on Monday.

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you for this. Works as expected locally with MySQL (which makes sense - the query is identical in that case). Looks like it should work with other database providers as well.

I'll fix up the commit message things I noted above on merge.

@GuySartorelli GuySartorelli merged commit 9d1741c into silverstripe:5 Feb 3, 2025
17 checks passed
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