protected processOrder ( |
||
$search | The search from which the query is build, if the search does not reflect any ordering no actions needs to be taken, *(not null not empty). | |
$qb | Doctrine\ORM\QueryBuilder | The Doctrine query builder to be constructed on, *(not null not empty). |
protected function processOrder(Search $search, QueryBuilder $qb)
{
foreach ($search->getOrderedBy() as $column) {
/** @var $column Newscoop\Service\Model\Search\ColumnOrder */
if ($column instanceof ColumnOrder) {
$field = self::ALIAS . '.' . $this->map($search, $column);
if ($column->isOrderAscending() === TRUE) {
$order = 'ASC';
} else {
$order = 'DESC';
}
$qb->addOrderBy($field, $order);
}
}
}