]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
a stream function for Fave class
authorEvan Prodromou <evan@status.net>
Sun, 12 Dec 2010 17:22:04 +0000 (12:22 -0500)
committerEvan Prodromou <evan@status.net>
Sun, 12 Dec 2010 17:22:04 +0000 (12:22 -0500)
classes/Fave.php

index 030e67b56138fc796552e8edd149126a880b9d97..3aa23e7b4e6f2ed39c1e9b880539fc998c164f12 100644 (file)
@@ -167,4 +167,32 @@ class Fave extends Memcached_DataObject
 
         return $act;
     }
 
         return $act;
     }
+
+    /**
+     * Fetch a stream of favorites by profile
+     *
+     * @param integer $profileId Profile that faved
+     * @param integer $offset    Offset from last
+     * @param integer $limit     Number to get
+     *
+     * @return mixed stream of faves, use fetch() to iterate
+     *
+     * @todo Cache results
+     * @todo integrate with Fave::stream()
+     */
+
+    static function byProfile($profileId, $offset, $limit)
+    {
+        $fav = new Fave();
+
+        $fav->user_id = $profileId;
+
+        $fav->orderBy('modified DESC');
+
+        $fav->limit($offset, $limit);
+
+        $fav->find();
+
+        return $fav;
+    }
 }
 }