0

How is it possible to add an ORDER BY columnName IS NULL DESC, columnName DESC to a Propel query. I have the same problem as in this question but I can't seem to find a proper solution using Propel methods. Since this clause will be embedded in a rather complex query building process, I do not want to just move to plain SQL.

twigmac
  • 1,772
  • 3
  • 21
  • 38

1 Answers1

1

If you use ModelCriteria you could try:

$query = YourEntityQuery::create('e')
    ->withColumn('e.sortColumn IS NULL', 'isSortColumnNull')
    ->orderBy('isSortColumnNull', 'desc')
    ->orderBy('e.sortColumn', 'desc');
W0rma
  • 309
  • 2
  • 9