src/Data/DefaultDataProviderDBalUtils.php
public static function addSorting(ConfigInterface $config, QueryBuilder $queryBuilder)
    {
        if (empty($config->getSorting()) || !is_array($config->getSorting())) {
            return;
        }

        foreach ($config->getSorting() as $sort => $order) {
            // array could be a simple field list or list of field => direction combinations.
            if (!empty($order)) {
                $order = strtoupper($order);
                if (!in_array($order, [DCGE::MODEL_SORTING_ASC, DCGE::MODEL_SORTING_DESC])) {
                    $sort  = $order;
                    $order = DCGE::MODEL_SORTING_ASC;
                }
            } else {
                $order = DCGE::MODEL_SORTING_ASC;
            }

            $queryBuilder->addOrderBy($sort, $order);
        }
    }
public static function addSorting(ConfigInterface $config, QueryBuilder $queryBuilder)
    {
        if (empty($config->getSorting()) || !is_array($config->getSorting())) {
            return;
        }

        foreach ($config->getSorting() as $sort => $order) {
            // array could be a simple field list or list of field => direction combinations.
            if (!empty($order)) {
                $order = strtoupper($order);
                if (!in_array($order, [DCGE::MODEL_SORTING_ASC, DCGE::MODEL_SORTING_DESC])) {
                    $sort  = $order;
                    $order = DCGE::MODEL_SORTING_ASC;
                }
            } else {
                $order = DCGE::MODEL_SORTING_ASC;
            }

            $queryBuilder->addOrderBy($sort, $order);
        }
    }
public static function addSorting ( ConfigInterface $ config , QueryBuilder $ queryBuilder ) { if ( empty ( $ config -> getSorting ( ) ) || ! is_array ( $ config -> getSorting ( ) ) ) { return ; } foreach ( $ config -> getSorting ( ) as $ sort => $ order ) { // array could be a simple field list or list of field => direction combinations. if ( ! empty ( $ order ) ) { $ order = strtoupper ( $ order ) ; if ( ! in_array ( $ order , [ DCGE :: MODEL_SORTING_ASC , DCGE :: MODEL_SORTING_DESC ] ) ) { $ sort = $ order ; $ order = DCGE :: MODEL_SORTING_ASC ; } } else { $ order = DCGE :: MODEL_SORTING_ASC ; } $ queryBuilder -> addOrderBy ( $ sort , $ order ) ; } }
Add the order by part of a query.

@param ConfigInterface $config       The configuration to use.
@param QueryBuilder    $queryBuilder The query builder.

@return void
Add the order by part of a query .