public function addSort(string $field, $descending = false): self
    {
        $this->fields[$field] = $field.($descending ? '|desc' : '');

        return $this;
    }
public function addSort(string $field, $descending = false): self
    {
        $this->fields[$field] = $field.($descending ? '|desc' : '');

        return $this;
    }
public function addSort ( string $ field , $ descending = false ) : self { $ this -> fields [ $ field ] = $ field . ( $ descending ? '|desc' : '' ) ; return $ this ; }
Add a sort to this query.

@param string $field      The field to sort on, such as 'id' or 'title'.
@param bool   $descending (optional) True if results should be sorted descending, false otherwise.

@return self
Add a sort to this query .