com\setasign\Konquadrat\Object\ObjectSet
Sorter
File: /Konquadrat/src/Object/ObjectSet/Sorter.php
Class hierarchy
Summary
Methods
sort()
Orders an array of abstract objects.
If $orders is callable, the callback will be used as usort.
The first and second params are the object data for the compared objects.
If $orders is a string then the objectSet will be sorted by this field ascending.
In most cases $orders should be an array like this:
$orders = [
['fieldOne', 'DESC'],
['fieldTwo'], //'ASC' is default (also if not 'ASC' or 'DESC')
['fieldThree', 'desc'], //order is case-insensitive
['referenceField->Subfield', 'asc']
]If both compared reference fields are null then the next filter will be used.
If two objects are equal (only the compared fields) then the order of the objects is undefined (each call will produce another order).
If a reference object doesn't exist in this objectSet then it will be handled like a null reference field.
Parameters
- $objects : \com\setasign\Konquadrat\Object\AbstractObject[]
- $orders : string|array|callable
