public function orderBy($field, $mode = 'ASC')
    {
        $mode = strtoupper($mode);
        if ( ! in_array($mode, ['ASC', 'DESC'])) {
            throw new \InvalidArgumentException("Error order by mode");
        }
        // is the first time call orderBy method ?
        if ($this->_orderby_str == '') {
            $this->_orderby_str = ' ORDER BY '.self::_wrapRow($field).' '.$mode;
        } else {
            $this->_orderby_str .= ' , '.self::_wrapRow($field).' '.$mode;
        }

        return $this;
    }
public function orderBy($field, $mode = 'ASC')
    {
        $mode = strtoupper($mode);
        if ( ! in_array($mode, ['ASC', 'DESC'])) {
            throw new \InvalidArgumentException("Error order by mode");
        }
        // is the first time call orderBy method ?
        if ($this->_orderby_str == '') {
            $this->_orderby_str = ' ORDER BY '.self::_wrapRow($field).' '.$mode;
        } else {
            $this->_orderby_str .= ' , '.self::_wrapRow($field).' '.$mode;
        }

        return $this;
    }
public function orderBy ( $ field , $ mode = 'ASC' ) { $ mode = strtoupper ( $ mode ) ; if ( ! in_array ( $ mode , [ 'ASC' , 'DESC' ] ) ) { throw new \ InvalidArgumentException ( "Error order by mode" ) ; } // is the first time call orderBy method ? if ( $ this -> _orderby_str == '' ) { $ this -> _orderby_str = ' ORDER BY ' . self :: _wrapRow ( $ field ) . ' ' . $ mode ; } else { $ this -> _orderby_str .= ' , ' . self :: _wrapRow ( $ field ) . ' ' . $ mode ; } return $ this ; }
build orderBy string

@param  string $field
@param  string $mode
@return  self
@throws  \InvalidArgumentException
build orderBy string