From 2e164eae516375974e24f758b6cc336f7f315126 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 13 Dec 2012 00:46:17 +0100 Subject: [PATCH] API Report::get_reports() returns native array (fixes #8096) Used to return ArrayList, but since 9d74c99e08 its no longer using keys, which they functionality using these return values rely on. Hence the breakage of ReportAdmin, since no report was being detected as "current" by looking through the array keys. --- code/reports/Report.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/reports/Report.php b/code/reports/Report.php index 4a94569f..08d005fc 100644 --- a/code/reports/Report.php +++ b/code/reports/Report.php @@ -163,7 +163,7 @@ class SS_Report extends ViewableData { /** * Return the SS_Report objects making up the given list. - * @return ArrayList an arraylist of SS_Report objects + * @return Array of SS_Report objects */ static public function get_reports() { $reports = ClassInfo::subclassesFor(get_called_class()); @@ -182,13 +182,12 @@ class SS_Report extends ViewableData { } } - //convert array into ArrayList - $list = ArrayList::create($reportsArray); + uasort($reportsArray, function($a, $b) { + if($a->sort == $b->sort) return 0; + else return ($a->sort < $b->sort) ? -1 : 1; + }); - //sort - $list = $list->sort('sort'); - - return $list; + return $reportsArray; } /////////////////////// UI METHODS ///////////////////////