Skip to content

Commit

Permalink
FIX Consistently quote orderby in DataQuery->ensureSelectContainsOrde…
Browse files Browse the repository at this point in the history
…rbyColumns()

Otherwise aggregate queries through DataQuery->column() fail unless the
passed in field is specifically quoted already. This fixes ManyManyListTest->testRemoveAll()
  • Loading branch information
chillu committed Apr 3, 2013
1 parent fb5ef02 commit 5a8a067
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions model/DataQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,14 @@ protected function ensureSelectContainsOrderbyColumns($query, $originalSelect =

if(isset($databaseFields[$parts[0]])) {
$qualCol = "\"$baseClass\".\"{$parts[0]}\"";

// remove original sort
unset($orderby[$k]);

// add new columns sort
$orderby[$qualCol] = $dir;

} else {
$qualCol = "\"$parts[0]\"";
}

// remove original sort
unset($orderby[$k]);
// add new columns sort
$orderby[$qualCol] = $dir;

// To-do: Remove this if block once SQLQuery::$select has been refactored to store getSelect()
// format internally; then this check can be part of selectField()
Expand Down

0 comments on commit 5a8a067

Please sign in to comment.