Permalink
Browse files

Permit use of array in Result->order()

  • Loading branch information...
1 parent 67996df commit e49d5d2f1bfe440dc82b61f46172635dfcb6f6dd @xblitz xblitz committed with Oct 30, 2014
Showing with 5 additions and 4 deletions.
  1. +5 −4 NotORM/Result.php
View
@@ -496,18 +496,19 @@ function __invoke($where, $parameters = array()) {
}
/** Add order clause, more calls appends to the end
- * @param string for example "column1, column2 DESC", empty string to reset previous order
+ * @param mixed "column1, column2 DESC" or array("column1", "column2 DESC"), empty string to reset previous order
* @param string ...
* @return NotORM_Result fluent interface
*/
function order($columns) {
$this->rows = null;
if ($columns != "") {
- foreach (func_get_args() as $columns) {
+ $columns = (is_array($columns) ? $columns : func_get_args());
+ foreach ($columns as $column) {
if ($this->union) {
- $this->unionOrder[] = $columns;
+ $this->unionOrder[] = $column;
} else {
- $this->order[] = $columns;
+ $this->order[] = $column;
}
}
} elseif ($this->union) {

0 comments on commit e49d5d2

Please sign in to comment.