Gdn_SQLDriver::orderBy PHP Method

orderBy() public method

Adds to the $this->_OrderBys collection.
public orderBy ( string $Fields, string $Direction = 'asc' ) : Gdn_SQLDriver
$Fields string A string of fields to be ordered.
$Direction string The direction of the sort.
return Gdn_SQLDriver $this
    public function orderBy($Fields, $Direction = 'asc')
    {
        if (!$Fields) {
            return $this;
        }
        if ($Direction && strtolower($Direction) != 'asc') {
            $Direction = 'desc';
        } else {
            $Direction = 'asc';
        }
        $this->_OrderBys[] = $this->escapeIdentifier($Fields, true) . ' ' . $Direction;
        return $this;
    }