The list of objects should contain the object uid as array key.
authorGunnar Wrobel <p@rdus.de>
Thu, 26 Mar 2009 10:25:51 +0000 (10:25 +0000)
committerGunnar Wrobel <p@rdus.de>
Thu, 26 Mar 2009 10:25:51 +0000 (10:25 +0000)
framework/Kolab_Server/lib/Horde/Kolab/Server.php
framework/Kolab_Server/lib/Horde/Kolab/Server/ldap.php
framework/Kolab_Server/test/Horde/Kolab/Server/testTest.php

index 17ba0f4..5cbb1eb 100644 (file)
@@ -88,7 +88,7 @@ abstract class Horde_Kolab_Server
      * @throws Horde_Kolab_Server_Exception If the requested Horde_Kolab_Server
      *                                      subclass could not be found.
      */
-    public function &factory($driver, $params = array())
+    static public function &factory($driver, $params = array())
     {
         $class = 'Horde_Kolab_Server_' . basename($driver);
         if (class_exists($class)) {
@@ -119,7 +119,7 @@ abstract class Horde_Kolab_Server
      *                                      missing or the given user could not
      *                                      be identified.
      */
-    public function &singleton($params = null)
+    static public function &singleton($params = null)
     {
         global $conf;
 
@@ -270,8 +270,8 @@ abstract class Horde_Kolab_Server
         }
 
         $hash = array();
-        foreach ($list as $entry) {
-            $hash[] = $entry->toHash($attributes);
+        foreach ($list as $uid => $entry) {
+            $hash[$uid] = $entry->toHash($attributes);
         }
 
         return $hash;
index a5ad742..ea9f760 100644 (file)
@@ -244,7 +244,7 @@ class Horde_Kolab_Server_ldap extends Horde_Kolab_Server
                 continue;
             }
             $result    = $this->fetch($dn, $type);
-            $objects[] = $result;
+            $objects[$dn] = $result;
         }
         return $objects;
     }
index a803c06..f28321f 100644 (file)
@@ -111,12 +111,12 @@ class Horde_Kolab_Server_testTest extends Horde_Kolab_Test_Server
         $result = $server->listObjects('Horde_Kolab_Server_Object_user');
         $this->assertNoError($result);
         $this->assertEquals(2, count($result));
-        $this->assertEquals('Horde_Kolab_Server_Object_user', get_class($result[0]));
+        $this->assertEquals('Horde_Kolab_Server_Object_user', get_class(array_shift($result)));
 
         $result = $server->listObjects('Horde_Kolab_Server_Object_sharedfolder');
         $this->assertNoError($result);
         $this->assertEquals(1, count($result));
-        $this->assertEquals('Horde_Kolab_Server_Object_sharedfolder', get_class($result[0]));
+        $this->assertEquals('Horde_Kolab_Server_Object_sharedfolder', get_class(array_shift($result)));
     }
 
     /**