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

Sort by expanded relationship property #849

Open
gertaMng opened this issue Jan 17, 2025 · 0 comments
Open

Sort by expanded relationship property #849

gertaMng opened this issue Jan 17, 2025 · 0 comments

Comments

@gertaMng
Copy link

Hello,

I have defined models BlacklistAgenti and Agente, which have the following relationship blacklistAgenti -> belongsTo(agenti)
Now I'm having problems sorting blacklistAgenti by the property of an extended relationship:
http://localhost:8080/odata/blacklistAgenti?$expand=agente&$orderby=agente/nome%20desc&$count=true&$top=10&$skip=0

The error I get is as follows:

code: "invalid_sort_property"
details: []
innererror: {}
message: "The orderby parameter specified properties (agente/nome) that did not exist"
target: null

It seams that it is totally ignoring the relationships.
I tried ordering by nested properties:
http://localhost:8080/odata/blacklistAgenti?$expand=agente($select=nome;$orderby=nome%20asc)&$count=true&$top=10&$skip=0
which doesn't throw any exception but doesn't return a collection sorted in the desired order.

The last approach i followed is by adding additional property to $appends using accessories, but still same as in #791 it tries to get it from the sql query.

Im currently using Laravel 11.0 + flat3/lodata 5.32

Thank you in advance.
@Remo @merouanekhalili @mgerzabek @27pchrisl @HoldYourWaffle

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

No branches or pull requests

1 participant