Example #1
0
 /**
  * Orders the results in descending order based on the value of this field.
  * @param Field $field The field to sort on.
  * @throws BadMethodCallException If {@link Field#needsJoin()} returns true.
  * @return Query This object.
  */
 public function orderDescending(Field $field)
 {
     if ($field->needsJoin()) {
         throw new BadMethodCallException("Field " . $field->getName() . " needs a join, so cannot be used for sorting");
     }
     $this->orderByStrings[] = '`' . $field->getNameInDatabase() . "` DESC";
     return $this;
 }