Skip to content

Sort by expanded relationship property #849

@gertaMng

Description

@gertaMng

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions