public function orderBy($field, string $op = null): self
    {
        // check operator is valid
        if ($op == null) {
            return $this->push('orderBy', $this->prepareField($field));
        }

        $op = strtoupper($op);
        if ($op != self::OP_ASC && $op != self::OP_DESC) {
            throw new BuilderException('Available ops: ASC, DESC');
        }

        return $this->push('orderBy', $this->prepareField($field) .' '. $op);
    }
public function orderBy($field, string $op = null): self
    {
        // check operator is valid
        if ($op == null) {
            return $this->push('orderBy', $this->prepareField($field));
        }

        $op = strtoupper($op);
        if ($op != self::OP_ASC && $op != self::OP_DESC) {
            throw new BuilderException('Available ops: ASC, DESC');
        }

        return $this->push('orderBy', $this->prepareField($field) .' '. $op);
    }
public function orderBy ( $ field , string $ op = null ) : self { // check operator is valid if ( $ op == null ) { return $ this -> push ( 'orderBy' , $ this -> prepareField ( $ field ) ) ; } $ op = strtoupper ( $ op ) ; if ( $ op != self :: OP_ASC && $ op != self :: OP_DESC ) { throw new BuilderException ( 'Available ops: ASC, DESC' ) ; } return $ this -> push ( 'orderBy' , $ this -> prepareField ( $ field ) . ' ' . $ op ) ; }
Order by.
@param  string|array|Builder $field
@param  string               $op
@return self
@throws Oppa\Query\BuilderException
Order by .