yii\data\ArrayDataProvider::sortModels PHP Method

sortModels() protected method

Sorts the data models according to the given sort definition
protected sortModels ( array $models, Sort $sort ) : array
$models array the models to be sorted
$sort Sort the sort definition
return array the sorted data models
    protected function sortModels($models, $sort)
    {
        $orders = $sort->getOrders();
        if (!empty($orders)) {
            ArrayHelper::multisort($models, array_keys($orders), array_values($orders));
        }
        return $models;
    }