Rename ProfileDataIterator to ProfileIterator
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 16 Mar 2010 19:26:53 +0000 (20:26 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 22 Mar 2010 12:49:28 +0000 (13:49 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/profile.php

index 4cfc845..b016b6d 100644 (file)
@@ -512,7 +512,7 @@ class Profile
                               WHERE  p.pid IN ' . XDB::formatArray($pids) . '
                            GROUP BY  p.pid
                                   ' . $order);
-        return new ProfileDataIterator($it, $pids, $fields, $visibility);
+        return new ProfileIterator($it, $pids, $fields, $visibility);
     }
 
     public static function getPID($login)
@@ -709,7 +709,10 @@ class Profile
     }
 }
 
-class ProfileDataIterator
+
+/** Iterator over a set of Profiles
+ */
+class ProfileIterator implements PlIterator
 {
     private $iterator = null;
     private $fields;
@@ -855,45 +858,5 @@ class ProfileDataIterator
     }
 }
 
-/** Iterator over a set of Profiles
- * @param an XDB::Iterator obtained from a Profile::fetchProfileData
- */
-class ProfileIterator implements PlIterator
-{
-    private $pdi;
-    private $dbiter;
-
-    public function __construct(ProfileDataIterator &$pdi)
-    {
-        $this->pdi = $pdi;
-        $this->dbiter = $pdi->iterator();
-    }
-
-    public function next()
-    {
-        $data = $this->dbiter->next();
-        if ($data == null) {
-            return null;
-        } else {
-            return $this->pdi->fillProfile(Profile::get($data));
-        }
-    }
-
-    public function total()
-    {
-        return $this->dbiter->total();
-    }
-
-    public function first()
-    {
-        return $this->dbiter->first();
-    }
-
-    public function last()
-    {
-        return $this->dbiter->last();
-    }
-}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>