Returns the name of the column for ordering.

@return string
559702
public function getOrderColumn()
    {
        $requestedColumnNames = $this->getRequestedColumnNames()->toArray();

        $order = request('order');

        $orderColumn = $requestedColumnNames[$order[0]['column']];

        if ($methodName = $this->hasCustomOrdering($orderColumn)) {
            $orderColumn = $this->class::$methodName();
        } elseif ($methodName = $this->hasCustomRawOrdering($orderColumn)) {
            // Convert it into an array so that parent function can return directly
            $orderColumn = [$this->class::$methodName($order[0]['dir'])];
        }

        return $orderColumn;
    }
312697
public function getQualifiedOrderByColumns()
    {
        $columns   = $this->cmsOrderBy;
        $qualified = [];

        if (empty($columns)) return [];

        foreach ($columns as $column => $direction) {
            $qualified[ $this->getTable() . '.' . $column ] = $direction;
        }

        return $qualified;
    }
667008
protected function defaultOrdering()
    {
        collect($this->request->orderableColumns())
            ->map(function ($orderable) {
                $orderable['name'] = $this->getColumnName($orderable['column'], true);

                return $orderable;
            })
            ->reject(function ($orderable) {
                return $this->isBlacklisted($orderable['name']) && ! $this->hasOrderColumn($orderable['name']);
            })
            ->each(function ($orderable) {
                $column = $this->resolveRelationColumn($orderable['name']);

                if ($this->hasOrderColumn($column)) {
                    $this->applyOrderColumn($column, $orderable);
                } else {
                    $nullsLastSql = $this->getNullsLastSql($column, $orderable['direction']);
                    $normalSql = $this->wrap($column) . ' ' . $orderable['direction'];
                    $sql = $this->nullsLast ? $nullsLastSql : $normalSql;
                    $this->query->orderByRaw($sql);
                }
            });
    }
113313
public function getDatabaseName()
    {
        if (isset($this->_data['filter_column']) && is_string($this->_data['filter_column'])) {
            return $this->_data['filter_column'];
        }
        return $this->index();
    }
380948
public function getOrderByString()
    {
        $order = $this->getOrderBy();
        $arr = [];
        foreach ($order as $field => $direction) {
            $arr[] = $field.' '. $direction;
        }
        return implode(",", $arr);
    }
274055
protected function _getIdColumnName()
        {
            if (!is_null($this->_instance_id_column)) {
                return $this->_instance_id_column;
            }

            if (isset(self::$_config[$this->_connection_name]['id_column_overrides'][$this->_table_name])) {
                return self::$_config[$this->_connection_name]['id_column_overrides'][$this->_table_name];
            }

            return self::$_config[$this->_connection_name]['id_column'];
        }
404445
protected function _getSortCol()
    {
        $aVisibleNames = $this->_getVisibleColNames();
        $iCol = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sort');
        $iCol = $iCol ? (( int ) str_replace('_', '', $iCol)) : 0;
        $iCol = (!isset($aVisibleNames[$iCol])) ? 0 : $iCol;

        return $iCol;
    }
538167
public function sortColumnsByOrder()
    {
        $columns = $this->_columns;
        foreach ($this->getColumnsOrder() as $columnId => $after) {
            if ($after[0] === '-') {
                $before = substr($after, 1);
                $after = null;
            } else {
                $before = null;
            }
            if ($after !== null && isset($columns[$after])) {
                $currentPosition = array_search($columnId, array_keys($columns));
                $value = array_splice($columns, $currentPosition, 1);

                $destPosition = array_search($after, array_keys($columns)) + 1;
                $columns = array_slice($columns, 0, $destPosition) + $value + array_slice($columns, $destPosition);
            } elseif ($before !== null && $columns[$before]) {
                $currentPosition = array_search($columnId, array_keys($columns));
                $value = array_splice($columns, $currentPosition, 1);

                $destPosition = array_search($before, array_keys($columns));
                $columns = array_slice($columns, 0, $destPosition) + $value + array_slice($columns, $destPosition);
            }
        }

        $this->_columns = $columns;

        end($this->_columns);
        $this->_lastColumnId = key($this->_columns);
        return $this;
    }
230019
public function getSequenceName()
    {
        $schemaManager = $this->getConnection()->getSchemaManager();

        try {
            $schemaManager->listSequences();

            return implode('_', [
                $this->tableName(),
                $this->getPrimaryKeyName(),
                'seq',
            ]);
        } catch (DBALException $e) {
            return;
        }
    }
636282
public function ordering()
    {
        if ($this->orderCallback) {
            call_user_func($this->orderCallback, $this);

            return;
        }

        foreach ($this->request->orderableColumns() as $orderable) {
            $column           = $this->getColumnName($orderable['column']);
            $this->collection = $this->collection->sortBy(
                    function ($row) use ($column) {
                $data = $this->serialize($row);

                return Arr::get($data, $column);
            }
            );

            if ($orderable['direction'] == 'desc') {
                $this->collection = $this->collection->reverse();
            }
        }
    }
245947
public function get_sql_sort() {
        $columns = $this->get_sort_columns();
        if (count($columns) == 1 && isset($columns['timemodified']) && $columns['timemodified'] == SORT_DESC) {
            // Add the 'id' column when we are using the default sorting.
            $columns['id'] = SORT_DESC;
            return self::construct_order_by($columns);
        }
        return parent::get_sql_sort();
    }
783677
public function sqlOrders()
    {
        if (!$this->hasOrders()) {
            return '';
        }

        $parts = [];
        foreach ($this->orders() as $order) {
            if (!$order instanceof DatabaseOrder) {
                $order = $this->createOrder($order->data());
            }

            $sql = $order->sql();
            if (strlen($sql) > 0) {
                $parts[] = $sql;
            }
        }

        if (empty($parts)) {
            return '';
        }

        return ' ORDER BY '.implode(', ', $parts);
    }
48941
public function getSortOrder()
    {
        $sortOrder = isset($this->requestParams[self::PARAM_SORT_ORDER]) ?
            $this->requestParams[self::PARAM_SORT_ORDER] : self::DEFAULT_SORT_ORDER;
        $sortOrder = mb_strtolower($sortOrder);

        if (!in_array($sortOrder, ['asc', 'desc'])) {
            $sortOrder = self::DEFAULT_SORT_ORDER;
        }

        return $sortOrder;
    }
886742
public function getTableName()
    {
        if (null == $this->tableName) {
            $this->tableName = $this->determineTableName();
        }
        return $this->tableName;
    }
2244
protected function getSortColumn()
    {
        if (!$this->isSortable()) {
            return false;
        }

        if ($this->sortColumn !== null) {
            return $this->sortColumn;
        }

        /*
         * User preference
         */
        if ($this->showSorting && ($sortOptions = $this->getSession('sort'))) {
            $this->sortColumn = $sortOptions['column'];
            $this->sortDirection = $sortOptions['direction'];
        }

        /*
         * Supplied default
         */
        else {
            if (is_string($this->defaultSort)) {
                $this->sortColumn = $this->defaultSort;
                $this->sortDirection = 'desc';
            }
            elseif (is_array($this->defaultSort) && isset($this->defaultSort['column'])) {
                $this->sortColumn = $this->defaultSort['column'];
                $this->sortDirection = $this->defaultSort['direction'] ?? 'desc';
            }
        }

        /*
         * First available column
         */
        if ($this->sortColumn === null || !$this->isSortable($this->sortColumn)) {
            $columns = $this->visibleColumns ?: $this->getVisibleColumns();
            $columns = array_filter($columns, function ($column) { return $column->sortable; });
            $this->sortColumn = key($columns);
            $this->sortDirection = 'desc';
        }

        return $this->sortColumn;
    }
700831
public function getIdentifiersName()
    {
        $name = $this->tableName . '[' . static::IDENTIFIERS . ']';

        if ($this->selectionMode == Config::SELECTION_MULTIPLE) {
            $name .= '[]';
        }

        return $name;
    }
999526
private function getSortOrder()
    {
        return [
            $this->translator->trans(/** @Desc("Ascending") */ 'content_type.sort_field.ascending', [], 'content_type') => Location::SORT_ORDER_ASC,
            $this->translator->trans(/** @Desc("Descending") */ 'content_type.sort_field.descending', [], 'content_type') => Location::SORT_ORDER_DESC,
        ];
    }