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

OrderBy does not work for nested collections with LoadStrategy.JOINED #1331

Closed
Langstra opened this issue Jan 22, 2021 · 1 comment · Fixed by #1336
Closed

OrderBy does not work for nested collections with LoadStrategy.JOINED #1331

Langstra opened this issue Jan 22, 2021 · 1 comment · Fixed by #1336
Assignees
Labels
bug Something isn't working

Comments

@Langstra
Copy link
Collaborator

Describe the bug
When loading nested collections using the LoadStrategy.JOINED it only orders by the first collection. For instance:
Project has Collection
Radio has Collection

both radio and option have a property order. When using LoadStrategy.JOINED it creates one query to load all entities and it only orders by the order of Radio. When using LoadStrategy.SELECT_IN it creates multiple queries and it orders by the order of Radio and the order of Option.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout PR xxx
  2. yarn test GHxxxx

Expected behavior
Should sort on both orders.

Versions

Dependency Version
node ?
typescript ?
mikro-orm ?
your-driver ?
@Langstra
Copy link
Collaborator Author

@B4nan please have a look at the fork of @TiesB he build a fix for this: TiesB@2183bb7

@B4nan B4nan added the bug Something isn't working label Jan 23, 2021
B4nan pushed a commit that referenced this issue Jan 23, 2021
Merges a joined relation's orderBy with the parent's, keeping table aliases in mind. 

Closes #1331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants