src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php
private function addSorting($qb, $sorting, $prefix = 'u')
    {
        // Add order by
        foreach ($sorting as $k => $d) {
            $qb->addOrderBy($prefix . '.' . $k, $d);
        }

        return $qb;
    }
private function addSorting($qb, $sorting, $prefix = 'u')
    {
        // Add order by
        foreach ($sorting as $k => $d) {
            $qb->addOrderBy($prefix . '.' . $k, $d);
        }

        return $qb;
    }
private function addSorting ( $ qb , $ sorting , $ prefix = 'u' ) { // Add order by foreach ( $ sorting as $ k => $ d ) { $ qb -> addOrderBy ( $ prefix . '.' . $ k , $ d ) ; } return $ qb ; }
Add sorting to querybuilder.

@param QueryBuilder $qb
@param array $sorting
@param string $prefix

@return QueryBuilder
Add sorting to querybuilder .