added table-column ordering (#1086)

This commit is contained in:
Kevin Papst
2019-09-09 23:47:42 +02:00
committed by GitHub
parent d041a3f4f9
commit a651e55dc9
82 changed files with 932 additions and 516 deletions

View File

@@ -212,9 +212,20 @@ class ProjectRepository extends EntityRepository
->select('p')
->from(Project::class, 'p')
->leftJoin('p.customer', 'c')
->addOrderBy('p.' . $query->getOrderBy(), $query->getOrder())
;
$orderBy = $query->getOrderBy();
switch ($orderBy) {
case 'customer':
$orderBy = 'c.name';
break;
default:
$orderBy = 'p.' . $orderBy;
break;
}
$qb->addOrderBy($orderBy, $query->getOrder());
if (in_array($query->getVisibility(), [ProjectQuery::SHOW_VISIBLE, ProjectQuery::SHOW_HIDDEN])) {
$qb
->andWhere($qb->expr()->eq('p.visible', ':visible'))