summaryrefslogtreecommitdiff
path: root/classes/Fave.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-12-12 12:22:04 -0500
committerEvan Prodromou <evan@status.net>2010-12-12 12:22:04 -0500
commit7c37aa802ba2bc0616c78f7490986af0051f7dc4 (patch)
treed4cb5fbbf0c254812b1398424effa2015dc5ee1d /classes/Fave.php
parent1817aedb5cf5c1cc7cfe1cb5146d087903b58e49 (diff)
a stream function for Fave class
Diffstat (limited to 'classes/Fave.php')
-rw-r--r--classes/Fave.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/classes/Fave.php b/classes/Fave.php
index 030e67b56..3aa23e7b4 100644
--- a/classes/Fave.php
+++ b/classes/Fave.php
@@ -167,4 +167,32 @@ class Fave extends Memcached_DataObject
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;
+ }
}