src/Koldy/Db/Query/Select.php
public function orderBy(string $field, string $direction = null): Select
    {
        if ($direction === null) {
            $direction = 'ASC';
        } else {
            $direction = strtoupper($direction);
        }

        if ($direction !== 'ASC' && $direction !== 'DESC') {
            throw new Exception("Can not use invalid direction order ({$direction}) in ORDER BY statement");
        }

        $this->orderBy[] = [
          'field' => $field,
          'direction' => $direction
        ];
        return $this;
    }
public function orderBy(string $field, string $direction = null): Select
    {
        if ($direction === null) {
            $direction = 'ASC';
        } else {
            $direction = strtoupper($direction);
        }

        if ($direction !== 'ASC' && $direction !== 'DESC') {
            throw new Exception("Can not use invalid direction order ({$direction}) in ORDER BY statement");
        }

        $this->orderBy[] = [
          'field' => $field,
          'direction' => $direction
        ];
        return $this;
    }
public function orderBy ( string $ field , string $ direction = null ) : Select { if ( $ direction === null ) { $ direction = 'ASC' ; } else { $ direction = strtoupper ( $ direction ) ; } if ( $ direction !== 'ASC' && $ direction !== 'DESC' ) { throw new Exception ( "Can not use invalid direction order ({$direction}) in ORDER BY statement" ) ; } $ this -> orderBy [ ] = [ 'field' => $ field , 'direction' => $ direction ] ; return $ this ; }
Add field to ORDER BY

@param string $field
@param string $direction

@throws Exception
@return Select
Add field to ORDER BY