Skip to content

Commit

Permalink
Permit use of array in Result->order()
Browse files Browse the repository at this point in the history
  • Loading branch information
xblitz authored and vrana committed Oct 30, 2014
1 parent 67996df commit e49d5d2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions NotORM/Result.php
Expand Up @@ -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) {
Expand Down

0 comments on commit e49d5d2

Please sign in to comment.