silverstripe/sapphire — pull request #1737 by fonsekaean (2013-04-08 15:46:40+00:00)
Title: Update DataQuery.php

DataQuery::ensureSelectContainsOrderbyColumns wont add fields which are not in
database tables FIXED

The goal was to add in a order by clues like the one below.

Product.CategoryID=10 DESC, Price ASC

where it should return the products price asc but return the products in category 10 first.

the problem here is that the DataQuery adds in a Select to the query called, Product.CategoryID=10

obviously there is no such column and the query fails. I've added a check to see whether that column is in the DB before adding it to the Select