/** * @param Request $request * * @throws \Exception */ public function handleRequest(Request $request) { $this->filterConfig->handleRequest($request); }
/** * @param QueryBuilder $qb * @param SortConfig $sortConfig */ protected function applySort(QueryBuilder $qb, SortConfig $sortConfig) { $column = $sortConfig->getColumn(); if (!$column || !$this->family->hasAttribute($column)) { parent::applySort($qb, $sortConfig); return; } $attribute = $this->family->getAttribute($column); $uid = uniqid('join'); $fullColumnReference = $uid . '.' . $attribute->getType()->getDatabaseType(); $qb->leftJoin($this->alias . '.values', $uid, Join::WITH, "({$uid}.data = {$this->alias}.id AND ({$uid}.attributeCode = '{$attribute->getCode()}' OR {$uid}.id IS NULL))"); $direction = $sortConfig->getDirection() ? 'DESC' : 'ASC'; // null or false both default to ASC $qb->addOrderBy($fullColumnReference, $direction); }