From: Evan Prodromou Date: Sun, 12 Dec 2010 17:22:04 +0000 (-0500) Subject: a stream function for Fave class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7c37aa802ba2bc0616c78f7490986af0051f7dc4;p=quix0rs-gnu-social.git a stream function for Fave class --- diff --git a/classes/Fave.php b/classes/Fave.php index 030e67b561..3aa23e7b4e 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; + } }