From 45408142e9d7431dd4a664262d4806c655cc5c68 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 8 Dec 2009 21:02:54 -0500 Subject: [PATCH] reorder notices when not using memcached --- classes/Notice.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index bcd7947bd1..c36c5a9c6b 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -788,10 +788,24 @@ class Notice extends Memcached_DataObject return $notice; } $notice->whereAdd('id in (' . implode(', ', $ids) . ')'); - $notice->orderBy('id DESC'); $notice->find(); - return $notice; + + $temp = array(); + + while ($notice->fetch()) { + $temp[$notice->id] = clone($notice); + } + + $wrapped = array(); + + foreach ($ids as $id) { + if (array_key_exists($id, $temp)) { + $wrapped[] = $temp[$id]; + } + } + + return new ArrayWrapper($wrapped); } } -- 2.39.5