src/xPDO/Om/xPDOQuery.php
public function sortby($column, $direction= 'ASC') {
        /* The direction can only be ASC or DESC; anything else is bogus */
        if (!in_array(strtoupper($direction), array('ASC', 'DESC', 'ASCENDING', 'DESCENDING'), true)) {
            $direction = '';
        }

        if (!static::isValidClause($column)) {
            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'SQL injection attempt detected in sortby column; clause rejected');
        } elseif (!empty($column)) {
            $this->query['sortby'][] = array('column' => $column, 'direction' => $direction);
        }
        return $this;
    }
public function sortby($column, $direction= 'ASC') {
        /* The direction can only be ASC or DESC; anything else is bogus */
        if (!in_array(strtoupper($direction), array('ASC', 'DESC', 'ASCENDING', 'DESCENDING'), true)) {
            $direction = '';
        }

        if (!static::isValidClause($column)) {
            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'SQL injection attempt detected in sortby column; clause rejected');
        } elseif (!empty($column)) {
            $this->query['sortby'][] = array('column' => $column, 'direction' => $direction);
        }
        return $this;
    }
public function sortby ( $ column , $ direction = 'ASC' ) { /* The direction can only be ASC or DESC; anything else is bogus */ if ( ! in_array ( strtoupper ( $ direction ) , array ( 'ASC' , 'DESC' , 'ASCENDING' , 'DESCENDING' ) , true ) ) { $ direction = '' ; } if ( ! static :: isValidClause ( $ column ) ) { $ this -> xpdo -> log ( xPDO :: LOG_LEVEL_ERROR , 'SQL injection attempt detected in sortby column; clause rejected' ) ; } elseif ( ! empty ( $ column ) ) { $ this -> query [ 'sortby' ] [ ] = array ( 'column' => $ column , 'direction' => $ direction ) ; } return $ this ; }
Add an ORDER BY clause to the query.

@param string $column Column identifier to sort by.
@param string $direction The direction to sort by, ASC or DESC.
@return xPDOQuery Returns the instance.
Add an ORDER BY clause to the query .