Returns the order by clause for this query

@return string The order by clause string
342376
public function getOrderBy()
    {
        $template = "ORDER BY %s";
        $orderBy = null;
        if (!is_null($this->_sql->orderBy)) {
            $orderBy = trim(sprintf($template, $this->_sql->getOrderBy()));
        }
        return $orderBy;
    }
47144
protected function getOrderQuery( $orders = array() )
	{
		if( is_array( $orders ) && count( $orders ) )
		{
			$order = array();
			foreach( $orders as $key => $value )
				$order[] = $key.' '.$value;
			$orders = ' ORDER BY '.implode( ', ', $order );
		}
		else
			$orders = '';
		return $orders;
	}
569364
public function get_sql() : string {
		if ( empty( $this->columns_to_select ) ) {
			// this should be the default behavior
			$this->columns_to_select = [ '*' ];
		}

		$from = ' FROM ' . implode( ', ', $this->from ) . ' ';

		if ( ! empty( $this->joins ) ) {
			$from .= $this->joins;
		}

		$from  .= 'WHERE ' . $this->where_clause;
		$select = 'SELECT ' . implode( ', ', $this->columns_to_select ) . $from;

		if ( ! empty( $this->group_by ) ) {
			$select .= 'GROUP BY ' . implode( ', ', $this->group_by ) . ' ';
		}

		if ( $this->order_by !== '' ) {
			$select .= 'ORDER BY ' . $this->order_by . ' ';
		}

		$select .= 'LIMIT ' . $this->limit;

		if ( $this->offset !== '' ) {
			$select .= ' OFFSET ' . $this->offset;
		}

		return $select;
	}
34095
private function getOrderDirection(): string
    {
        $result = !empty($this->searchData['sort_by_order']) ?
            $this->searchData['sort_by_order'] :
            Options::DEFAULT_SORT_BY_ORDER;

        return $result;
    }
950568
public function getNext()
    {
        return $this
            ->where(self::ATTR_PAGE, $this->getPageId())
            ->where(self::ATTR_CREATED_AT, '>', $this->getEditedTime()->getTimestamp())
            ->orderBy(self::ATTR_CREATED_AT, 'asc')
            ->first();
    }
410089
public function getClauses()
    {
        // This is a cheap fix for `SELECT` statements that contain `UNION`.
        // The `ORDER BY` and `LIMIT` clauses should be at the end of the
        // statement.
        if (! empty($this->union)) {
            $clauses = static::$CLAUSES;
            unset($clauses['ORDER BY'], $clauses['LIMIT']);
            $clauses['ORDER BY'] = [
                'ORDER BY',
                3,
            ];
            $clauses['LIMIT'] = [
                'LIMIT',
                3,
            ];

            return $clauses;
        }

        return static::$CLAUSES;
    }
1205129
public function orderBy() {
        $args = func_get_args();
        $this->build()->bindExpression('orderBy', $args[0] . " " . (empty($args[1]) ? ' ASC ' : " $args[1]"));

        return $this->connection;
    }
401429
protected function getListOrder()
    {
        $id = $this->getParam(0);
        $limit = $this->getLimit();

        if (!isset($id)) {
            return $this->order->getList(array('limit' => $limit));
        }

        if ($this->getParam('user')) {
            return $this->order->getList(array('user_id' => $id, 'limit' => $limit));
        }

        if ($this->getParam('status')) {
            return $this->order->getList(array('status' => $id, 'limit' => $limit));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if ($this->getParam('store')) {
            return $this->order->getList(array('store_id' => $id, 'limit' => $limit));
        }

        if ($this->getParam('shipping-address')) {
            return $this->order->getList(array('shipping_address' => $id, 'limit' => $limit));
        }

        if ($this->getParam('payment-address')) {
            return $this->order->getList(array('payment_address' => $id, 'limit' => $limit));
        }

        $result = $this->order->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
728951
public function getQuery()
    {
        $query = parent::getQuery();
        if ( $this->hasLimit )
        {
            $max = $this->offset + $this->limit;
            if ( $this->offset > 0 ) 
            {
                $min = $this->offset + 1;
                $query = "SELECT * FROM (SELECT a.*, ROWNUM rn FROM ( {$query} ) a WHERE rownum <= {$max} ) WHERE rn >= {$min}";
            }
            else 
            {
                $query = "SELECT a.* FROM ( {$query} ) a WHERE ROWNUM <= {$max}";
            }            
        }
        return $query;
    }
294411
public function getOrderTotalLines()
    {
        if (!$this->orderTotalLines) {
            $orderModel = $this->getRegistry()->getOrderModel();
            $this->orderTotalLines = $orderModel->getOrderTotals($this->source['order_id']);
        }
        return $this->orderTotalLines;
    }
1134211
public function getWhereStatement()
    {
        if (empty($this->where)) {
            return false;
        }
        $this->where[0]['operation'] = null;
        $str = '';
        foreach ($this->where as $clause) {
            $str .= trim("{$clause['operation']} {$clause['condition']}");
            $str .= " ";
        }

        return trim($str);
    }
202007
private function getSelectQuery()
	{
		$result = $this->getSelectClause();

		if ($join = $this->getJoinClause()) {
			$result .= ' ' . $join;
		}

		if ($where = $this->getWhereClause()) {
			$result .= ' ' . $where;
		}

		if ($groupBy = $this->getGroupByClause()) {
			$result .= ' ' . $groupBy;
		}

		if ($orderBy = $this->getOrderByClause()) {
			$result .= ' ' . $orderBy;
		}

		if ($limit = $this->getLimitClause()) {
			$result .= ' ' . $limit;
		}

		if ($offset = $this->getOffsetClause()) {
			$result .= ' ' . $offset;
		}

		return $result;
	}
1335230
public function buildOrder()
	{
		$orders = [];

		foreach ($this->order as $order)
		{
			if (is_object($order['column']))
			{
				$string = $order['column']->build($this);
			}
			else
			{
				$string = $this->connection->quoteName($order['column']);
			}

			$string .= ' ' . strtoupper($order['dir']);
			$orders[] = $string;
		}

		return 'ORDER BY ' . implode(',', $orders);
	}
336978
public function getQuery()
    {
        // Return the query if it exists
        if (!empty($this->query)) {
            return $this->query;
        }

        /*
         * Looks like our query hasn't been assembled
         * yet, let's try to assemble it
         */
        $this->assembleQuery();

        // Return the assembled query
        return $this->query;
    }
1138924
public function getQuery()
    {
        $query = parent::getQuery();

        if (!is_null($query)) {
            $query->setHint(
                \Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER,
                'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker'
            );
            $query->useQueryCache(false);
        }

        return $query;
    }
91374
protected function getOrder()
    {
        $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
        $order->load($this->getSession()->getVariable('sess_challenge'));

        return $order;
    }
315860
public function mysqlReOrder()
    {
        $group = $this->getGroup();

        $res = $this->query("SELECT `".$this->row_id."`
                             FROM `".$this->table."`
                             ".$group."
                             ORDER BY `".$this->cell."`
                            ");
        $query = [];
        $i = $this->reorder;
        while($row = $res->fetch_assoc())
            $query[] = "UPDATE `".$this->table."` SET `".$this->cell."` = ".$i++." WHERE `".$this->row_id."`= ".$row[$this->row_id];

        return ($this->query($query)) ? 9 : 10;
    }