/** * @param QueryBuilder $qb * @param SortConfig $sortConfig */ protected function applySort(QueryBuilder $qb, SortConfig $sortConfig) { $column = $sortConfig->getColumn(); if ($column) { $fullColumnReference = $column; if (false === strpos($column, '.')) { $fullColumnReference = $this->alias . '.' . $column; } $direction = $sortConfig->getDirection() ? 'DESC' : 'ASC'; // null or false both default to ASC $qb->addOrderBy($fullColumnReference, $direction); } }
/** * @param Query $query * @param SortConfig $sortConfig */ protected function applyESSort(Query $query, SortConfig $sortConfig) { $column = $sortConfig->getColumn(); if ($column) { $direction = $sortConfig->getDirection() ? 'desc' : 'asc'; // null or false both default to ASC $query->addSort([$column => ['order' => $direction]]); } }