Permalink
Browse files

FIX Consistently quote orderby in DataQuery->ensureSelectContainsOrde…

…rbyColumns()

Otherwise aggregate queries through DataQuery->column() fail unless the
passed in field is specifically quoted already. This fixes ManyManyListTest->testRemoveAll()
  • Loading branch information...
1 parent fb5ef02 commit 5a8a067ae8df6265664a05cb6d5bf9c27b78cba4 @chillu chillu committed Apr 2, 2013
Showing with 5 additions and 7 deletions.
  1. +5 −7 model/DataQuery.php
View
12 model/DataQuery.php
@@ -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()

0 comments on commit 5a8a067

Please sign in to comment.