silverstripe / silverstripe-graphql

Serves Silverstripe data as GraphQL representations
BSD 3-Clause "New" or "Revised" License
52 stars 61 forks source link

FIX QuerySort::sort method should support sorting for multi arguments #563

Closed sabina-talipova closed 9 months ago

sabina-talipova commented 9 months ago

Description

Even if a method receives several parameters, then sorting occurs by the field of the arguments that is last specified in the schema, and not in the passed parameters. That is, if SilverStripe\GraphQL\Tests\Fake\DataObjectFake has the following schema

fields:
    myField: true
    AuthorID: true

and sorting is required AuthorID => DESC, myField => ASC, then sorting was done only by AuthorID, since in the schema this field is indicated after myField. Therefore, the call $list->sort() must be completed after all the necessary processing has been carried out.

Parent issue