Skip to content

Fix contains many sort order if several sort arguments are passed#1300

Draft
PhilippGrashoff wants to merge 4 commits into
atk4:developfrom
PhilippGrashoff:fix-contains-many-sort-order
Draft

Fix contains many sort order if several sort arguments are passed#1300
PhilippGrashoff wants to merge 4 commits into
atk4:developfrom
PhilippGrashoff:fix-contains-many-sort-order

Conversation

@PhilippGrashoff

@PhilippGrashoff PhilippGrashoff commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The issue might not be directly in ContainsMany itself but in the underlying persistence. The issue is:
if several sort arguments are passed to a ContainsMany Reference, they are applied in reverse order:
If $someParent->ref('some_contains_many_reference')->setOrder(['field1' => 'ASC', 'field2' => 'ASC'] is used, the actual sort is using the arguments in reverse order, so first sorts by field2, and then sorts by field1 for those entities with same field2 values.

For now, I added a failing test to demonstrate the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant