From d399e611d65d637cc53574aa81cb01fb108b1cca Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Mon, 1 Aug 2005 15:32:54 +0000 Subject: [PATCH] Support an orderby option --- lib/ktentity.inc | 7 +++++++ 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/ktentity.inc b/lib/ktentity.inc index 1d5b123..48517ce 100644 --- a/lib/ktentity.inc +++ b/lib/ktentity.inc @@ -226,6 +226,9 @@ class KTEntityUtil { } function &getList($sTable, $sClassName, $sWhereClause = null, $aOptions = null) { + if (is_null($aOptions)) { + $aOptions = array(); + } $bIDs = false; $sIDField = 'id'; if (is_array($aOptions)) { @@ -254,6 +257,10 @@ class KTEntityUtil { return new PEAR_Error('Weird WhereClause passed'); } } + $sOrderBy = KTUtil::arrayGet($aOptions, 'orderby'); + if (!empty($sOrderBy)) { + $sQuery .= "ORDER BY " . $sOrderBy; + } $aIDs = DBUtil::getResultArrayKey(array($sQuery, $aParams), $sIDField); if ($bIDs === true) { -- libgit2 0.21.4