From 21f501fb352fb26bf8a469622a1a7ad0e7108114 Mon Sep 17 00:00:00 2001 From: TimWolla Date: Thu, 14 Jul 2011 22:07:17 +0200 Subject: [PATCH] Implemented this suggestion (as it is already planned): https://www.woltlab.com/bugtracker/index.php?page=Bug&bugID=1427 --- .../install/files/lib/data/DatabaseObject.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/data/DatabaseObject.class.php b/wcfsetup/install/files/lib/data/DatabaseObject.class.php index 07e639cf22..84d8943344 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObject.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObject.class.php @@ -145,10 +145,16 @@ abstract class DatabaseObject implements StorableObject { * @param string $sortOrder * @return boolean */ - public static function sort(&$objects, $sortBy, $sortOrder = 'ASC') { + public static function sort(&$objects, $sortBy, $sortOrder = 'ASC', $maintainIndexAssociation = true) { static::$sortBy = (!is_array($sortBy) ? array($sortBy) : $sortBy); static::$sortOrder = (!is_array($sortOrder) ? array($sortOrder) : $sortOrder); - return uasort($objects, array('static', 'compareObjects')); + + if ($maintainIndexAssociation) { + return uasort($objects, array('static', 'compareObjects')); + } + else { + return usort($objects, array('static', 'compareObjects')); + } } /** -- 2.20.1