Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Sorting related data

The following is not doing what I had hoped for:

    $this->hasMany("id", "OrderItems", "order_id", ['order' => 'online_reference DESC']);

Can someone please correct me?


You can use:

$sortedParts = $robot->getParts(['order' => 'online_reference DESC']);

There's no way to define it there where you're expecting