R3m/framework Features Sort class


The sort class extends the data class. it uses an array with with.


  "6aa5e5b8-7288-4a51-a39b-ff40df387953": {
    "label": [
    "content": "...",
    "uuid": "6aa5e5b8-7288-4a51-a39b-ff40df387953",
    "title": "...",
    "ctime": 1609157496,
    "mtime": 1609157496
$result = Sort::list($result)->with(['mtime' => 'DESC', 'title' => 'ASC']);

Sort a list with mtime (modification time) Descending and with the title Ascending.
Currently, max. 2 different attributes are sorted either DESC (Descending) or ASC (Ascending).
In this example it is first sorted on mtime. If the mtime is the same it will sort on the title.
The sort expects that the element has an uuid if not it will generate one and adds it as an attribute to the element.

Last modified: 2021-06-07

© 2021 universeorange.com