src/Data/DefaultDataProviderSqlUtils.php
public static function buildSortingQuery($config)
    {
        $sorting = $config->getSorting();
        $result  = '';
        $fields  = [];

        if (empty($sorting) || !\is_array($sorting)) {
            return '';
        }
        foreach ($sorting as $field => $direction) {
            // array could be a simple field list or list of field => direction combinations.
            if (!empty($direction)) {
                $direction = \strtoupper($direction);
                if (!\in_array($direction, [DCGE::MODEL_SORTING_ASC, DCGE::MODEL_SORTING_DESC])) {
                    $field     = $direction;
                    $direction = DCGE::MODEL_SORTING_ASC;
                }
            } else {
                $direction = DCGE::MODEL_SORTING_ASC;
            }

            $fields[] = $field . ' ' . $direction;
        }

        $result .= ' ORDER BY ' . \implode(', ', $fields);

        return $result;
    }
public static function buildSortingQuery($config)
    {
        $sorting = $config->getSorting();
        $result  = '';
        $fields  = [];

        if (empty($sorting) || !\is_array($sorting)) {
            return '';
        }
        foreach ($sorting as $field => $direction) {
            // array could be a simple field list or list of field => direction combinations.
            if (!empty($direction)) {
                $direction = \strtoupper($direction);
                if (!\in_array($direction, [DCGE::MODEL_SORTING_ASC, DCGE::MODEL_SORTING_DESC])) {
                    $field     = $direction;
                    $direction = DCGE::MODEL_SORTING_ASC;
                }
            } else {
                $direction = DCGE::MODEL_SORTING_ASC;
            }

            $fields[] = $field . ' ' . $direction;
        }

        $result .= ' ORDER BY ' . \implode(', ', $fields);

        return $result;
    }
public static function buildSortingQuery ( $ config ) { $ sorting = $ config -> getSorting ( ) ; $ result = '' ; $ fields = [ ] ; if ( empty ( $ sorting ) || ! \ is_array ( $ sorting ) ) { return '' ; } foreach ( $ sorting as $ field => $ direction ) { // array could be a simple field list or list of field => direction combinations. if ( ! empty ( $ direction ) ) { $ direction = \ strtoupper ( $ direction ) ; if ( ! \ in_array ( $ direction , [ DCGE :: MODEL_SORTING_ASC , DCGE :: MODEL_SORTING_DESC ] ) ) { $ field = $ direction ; $ direction = DCGE :: MODEL_SORTING_ASC ; } } else { $ direction = DCGE :: MODEL_SORTING_ASC ; } $ fields [ ] = $ field . ' ' . $ direction ; } $ result .= ' ORDER BY ' . \ implode ( ', ' , $ fields ) ; return $ result ; }
Build the order by part of a query.

@param ConfigInterface $config The configuration to use.

@return string

@deprecated Use DefaultDataProviderDBalUtils::addSorting. This will be removed.
Build the order by part of a query .