Set the bucket sort order.

@param string $order     "_count", "_term", or the name of a sub-aggregation or sub-aggregation response field
@param string $direction "asc" or "desc"

@return $this
320577
public function setOrder(string $order, string $direction): self
    {
        return $this->setParam('order', [$order => $direction]);
    }
973724
final public function setListOrderBy($fields, $direction = "ASC")
    {

        $direction = (in_array(strtoupper(trim($direction)), array('ASC', 'DESC'), TRUE)) ? ' ' . $direction : ' ASC';
        $orderby = NULL;
        //Clean up the order by field list
        if (!empty($fields) && !is_array($fields)) {
            $temp = array();
            foreach (explode(',', $fields) as $part) {
                $part = trim($part);
                $temp[] = $part;
            }

            $orderby = implode(', ', $temp);
        } else if (is_array($fields)) {
            $temp = array();
            foreach ($fields as $field) {
                $part = trim($field);
                $temp[] = $part;
            }
            $orderby = implode(', ', $temp);
        }


        if (!empty($orderby)) {
            $this->listOrderByStatement = "\nORDER BY " . $orderby . $direction;
        }
        //Return this object
        return $this;
    }
1188260
public function setOrder($order)
    {
        $this->_order = $order;
        $this->_state->order = $order;

        return $this;
    }
289804
public function thenByDesc($order)
    {
        $order = LambdaUtils::toSelectCallable($order);
        $this->orders[] = array("property" => $order, "direction" => self::ORDER_DESC);
        return $this;
    }
541732
public function thenBy($order)
    {
        $order = LambdaUtils::toSelectCallable($order);
        $this->orders[] = array("property" => $order, "direction" => self::ORDER_ASC);
        return $this;
    }
731978
public function sort($order = 'asc')
    {
        if ($order == 'desc') {
            rsort($this->_map);
        }else{
            sort($this->_map);
        }

        return $this;
    }
1250855
public function order($order)
    {
        $order = $this->prepareNames(func_get_args(),false);
        $this->order = $order;
        return $this;
    }
914372
public function add($field, $direction)
	{
		$this->orderRules[] = array(
				self::FIELD_POS => $field,
				self::DIRECTION_POS => $direction
		);
	}
1220238
protected function buildOrder($query, $filter, $order, $direction)
    {
        if (!empty($order)) {
            $direction = empty($direction) ? 'asc' : $direction;
            $query     = $query->orderBy($order, $direction);
        }

        return $query;
    }
1187245
public function orderByFixed($index, $direction = 'desc')
    {
        if ($direction != 'desc') {
            $direction = 'asc';
        }

        if (is_array($index)) {
            $this->attributes['orderFixed'][] = $index;
        } else {
            $this->attributes['orderFixed'][] = [$index, $direction];
        }

        return $this;
    }
478780
public function setOrder(\Librinfo\EcommerceBundle\Entity\Order $order = null)
    {
        $this->order = $order;

        return $this;
    }
278598
public function add_sort($field, $direction = 'ASC') {
        if (!isset($this->_query_modifiers['sort'])) {
            $this->_query_modifiers['sort'] = array();
        }

        $this->_query_modifiers['sort'][$field] = $direction;
    }
408290
public function set_sort($field,$order=false){
		if (!$field && !$order)
			$this->sort_by=array();
		else{
			if ($order===false)
				$this->sort_by[] = $field;
			else {
				$order=strtolower($order)=="asc"?"ASC":"DESC";
				$this->sort_by[]=array("name"=>$field,"direction" => $order);
			}
		}
	}
1136214
public function sortByEntityName($direction)
    {
        if ($this->id != '$entity') {
            throw new AnalyticsDbException('In order to sort by entity name, you need to first group by entity name.');
        }

        $direction = (int)$direction;
        $this->pipeline['$sort'] = ['_id' => $direction];

        return $this;
    }
910669
public function setOrder($order)
    {
        $order = in_array($order, ['ASC', 'DESC']) ? $order : 'ASC';

        $this->order = $order;

        return $this;
    }
854639
public function orderBy($field, $direction = 'asc')
    {
        $this->sort = $field;
        $this->sortDirection = $direction;

        return $this;
    }
512277
public function orderBy($column, $direction = IQueryBuilder::ORDER_ASC)
    {
        if ($direction == IQueryBuilder::ORDER_ASC || $direction == IQueryBuilder::ORDER_DESC) {
            $this->orderConditions[$column] = $direction;
        }

        return $this;
    }