DatabaseObjectList assigns table index value as array key
authorAlexander Ebert <ebert@woltlab.com>
Thu, 11 Aug 2011 14:30:09 +0000 (16:30 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 11 Aug 2011 14:30:09 +0000 (16:30 +0200)
wcfsetup/install/files/lib/data/DatabaseObjectList.class.php

index 2cc734977edbae4967a8720e8480ab160d18b9c9..d342f23fe4460fed01214aa8ce0e38a5d4aa120c 100644 (file)
@@ -154,6 +154,13 @@ abstract class DatabaseObjectList {
                        $statement->execute($this->getConditionBuilder()->getParameters());
                        $this->objects = $statement->fetchObjects($this->className);
                }
+               
+               // use table index as array index
+               $objects = array();
+               foreach($this->objects as $object) {
+                       $objects[$object->{$this->getDatabaseTableIndexName()}] = $object;
+               }
+               $this->objects = $objects;
        }
        
        /**