Apply simple sort.

@param Sort $sort
181569
protected function applySimpleSort(Sort $sort)
    {
        $this->query->orderBy($sort->getField(), $sort->getOrder());
    }
201826
public function orderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false);
    }
724708
public function setSort($sort, $field = null)
    {
        $param = $this->buildParam('facet.sort', $field);
        return $this->set($param, $sort);
    }
593256
public static function addOrderSort($sort, $table, &$query)
    {
        if (!empty($sort)) {
            $sorts = explode(',', $sort);
            foreach ($sorts as $sort) {
                if (!strpos($sort, '.')) {
                    preg_match('/\w+\s+(DESC|ASC)/', $sort, $sort_field);
                    $type = !empty($sort_field) ? trim($sort_field[1]) : 'DESC';
                    $field = !empty($sort_field) ? trim(substr($sort, 0, -strlen($type))) : trim($sort);
                    $order[$table . '.' . $field] = $type == 'DESC' ? SORT_DESC : SORT_ASC;
                } else {
                    $sort_table = trim(substr($sort, 0, strrpos($sort, '.')));
                    preg_match('/\w+\.\w+\s+(DESC|ASC)/', $sort, $sort_field);
                    $type = trim($sort_field[1]);
                    $field = trim(substr(substr($sort, strrpos($sort, '.') + 1), 0, -strlen($type)));
                    $order[trim($sort_table) . '.' . $field] = $type == 'DESC' ? SORT_DESC : SORT_ASC;;
                    $query->select[] = explode(' ', $sort_field[0])[0];
                    $query->joinWith($sort_table);
                }
            }
            $query->select[] = $table . ".*";
        }
        $query->orderBy($order);
    }
1247363
protected function sort(array &$files, $sort, $order)
    {
        $sorters = $this->getSorters();

        if (isset($sorters[$sort]['handlers']['sort'])) {
            $function = $sorters[$sort]['handlers']['sort'];
            // Suppress errors, see https://bugs.php.net/bug.php?id=50688
            @uasort($files, function ($a, $b) use ($function, $order) {
                return $function($a, $b, $order);
            });
        }
    }
248355
public function defaultSorts($sorts): self
    {
        $sorts = is_array($sorts) ? $sorts : func_get_args();

        $this->defaultSorts = collect($sorts)->map(function ($sort) {
            if (is_string($sort)) {
                return Sort::field($sort);
            }

            return $sort;
        });

        return $this;
    }
793655
public function setSort(array $sort)
    {
        if (count($sort) == 1) {
            $sort = $sort[0];
        }

        if (count($sort) > 1) {
            $sort = implode(',', $sort);
        }

        $this->queryString[] = 'sort=' . $sort;
    }
1193895
public function applyOrder($order)
    {
        switch ($order) {
            case 'time':
                $this->orderBy(['created_at' => SORT_ASC]);
                break;

            case 'supports':
            default:
                $this->orderBy(['(supports / pow((((UNIX_TIMESTAMP(NOW()) - created_at) / 3600) + 2),1.8) )' => SORT_DESC]);
                break;
        }

        return $order;
    }
1080041
public function sort(DataStructure\Sort $sorting)
    {
        $sortings = [];

        foreach ($sorting as $sortingEntity) {

            if ($this->isExcludedProperty($sortingEntity->getProperty())) {
                continue;
            }

            $sortings[$sortingEntity->getProperty()] =
                $sortingEntity instanceof DataStructure\Sort\Asc ? 'asc' : 'desc';
        }

        $this->criteria->orderBy($sortings);
    }
967264
public function setOrderBy($sort, $direction = 'ASC')
    {
        $this->sort = $sort;
        $this->direction = $direction;
        return $this;
    }
857824
private function runSorting()
    {
        $sort_method = 'sort'.studly_case($this->sortKey);

        // Apply the sorting for the query
        if (method_exists($this, $sort_method)) {
            $this->$sort_method($this->sortOrder);
        } else {
            $this->db->sort($this->sortKey, $this->sortOrder);
        }
    }
1312303
public function sortOrder1(int $sortOrder, bool $descendingFlag = false): void
  {
    $this->sortDirection = ($descendingFlag) ? 'desc' : 'asc';
    $this->sortOrder     = $sortOrder;
  }
479716
private function processOrderByParams($sort)
    {
        $direction       = (substr($sort, 0, 1) == '-') ? 'DESC' : 'ASC';
        $field           = (substr($sort, 0, 1) == '-') ? substr($sort, 1) : $sort;
        $this->orderBy[] = [
            snake_case($field),
            $direction
        ];
    }
726744
public function orderByIndex($label, $sort = 'ASC')
    {
        $this->join('cc._indexation', 'idx')
             ->andWhere('idx._field = :sort')
             ->setParameter('sort', $label)
             ->orderBy('idx._value', $sort);
    }
1014189
public function andSort(Sort $sort = null) : Sort
    {
        if ($sort === null) {
            return $this;
        }
        $orders = $this->orders;
        foreach ($sort as $order) {
            $orders[] = $order;
        }
        return new Sort($orders);
    }
816435
public function orderByCreatedAt($sort = SORT_ASC)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        if (!is_string($model->createdAtAttribute) || empty($model->createdAtAttribute)) {
            return $this;
        }
        return $this->addOrderBy([$model->createdAtAttribute => $sort]);
    }
485622
public function set_sortorder($sortorder) {
        if ($this->sortorder == $sortorder) {
            return;
        }
        $this->sortorder = $sortorder;
        $this->update();
    }