Extension/DoctrineORMExtension.php
private function orderQueryBuilderBy(QueryBuilder $queryBuilder, TableInterface $table, $sort)
    {
        if (!is_array($sort)) {
            $sort = array($sort => $table->getOption('order', 'DESC'));
        }

        foreach ($sort as $fieldName => $order) {
            // Check field is sortable
            $field = $table->getField($fieldName);
            if (!$field->getOption('sortable')) {
                throw new InvalidArgumentException("Field $fieldName is not sortable in table " . $table->getName());
            }

            foreach ((array)$field->getOption('order_path') as $orderBy) {
                $queryBuilder->addOrderBy($this->fixQueryPath($orderBy, $field), $order);
            }
        }
    }
private function orderQueryBuilderBy(QueryBuilder $queryBuilder, TableInterface $table, $sort)
    {
        if (!is_array($sort)) {
            $sort = array($sort => $table->getOption('order', 'DESC'));
        }

        foreach ($sort as $fieldName => $order) {
            // Check field is sortable
            $field = $table->getField($fieldName);
            if (!$field->getOption('sortable')) {
                throw new InvalidArgumentException("Field $fieldName is not sortable in table " . $table->getName());
            }

            foreach ((array)$field->getOption('order_path') as $orderBy) {
                $queryBuilder->addOrderBy($this->fixQueryPath($orderBy, $field), $order);
            }
        }
    }
private function orderQueryBuilderBy ( QueryBuilder $ queryBuilder , TableInterface $ table , $ sort ) { if ( ! is_array ( $ sort ) ) { $ sort = array ( $ sort => $ table -> getOption ( 'order' , 'DESC' ) ) ; } foreach ( $ sort as $ fieldName => $ order ) { // Check field is sortable $ field = $ table -> getField ( $ fieldName ) ; if ( ! $ field -> getOption ( 'sortable' ) ) { throw new InvalidArgumentException ( "Field $fieldName is not sortable in table " . $ table -> getName ( ) ) ; } foreach ( ( array ) $ field -> getOption ( 'order_path' ) as $ orderBy ) { $ queryBuilder -> addOrderBy ( $ this -> fixQueryPath ( $ orderBy , $ field ) , $ order ) ; } } }
Sets the order by

@param QueryBuilder $queryBuilder
@param TableInterface $table
@param $sort
Sets the order by