demos-europe / edt

Enables your PHP application to expose its entities as REST resources using the feature rich JSON:API specification as API. How and to whom your entities are exposed is highly customizable while minimizing boilerplate code.
MIT License
2 stars 1 forks source link

Automatically sort to-many relationships #156

Open joorei opened 3 months ago

joorei commented 3 months ago

Instances returned by an AbstractResourceType are automatically sorted by getDefaultSortMethods, but how should readability instances of to-many relationship properties behave? If they automatically use the getDefaultSortMethods method of their corresponding relationship type the sorting may conflict with \Doctrine\ORM\Mapping\OrderBy. Maybe a configuration could be provided in the readability instance (bool $applyDefaultSorting) to leave the decision to the developer. Or the to-many relationship readability could even take and apply custom sort methods with precedence over the ones defined in getDefaultSortMethods.