+
+ /**
+ * Grab a list of profile who have favored this notice.
+ *
+ * @return ArrayWrapper masquerading as a Fave
+ */
+ static function byNotice($noticeId)
+ {
+ $c = self::memcache();
+ $key = Cache::key('fave:by_notice:' . $noticeId);
+
+ $wrapper = $c->get($key);
+ if (!$wrapper) {
+ // @fixme caching & scalability!
+ $fave = new Fave();
+ $fave->notice_id = $noticeId;
+ $fave->find();
+
+ $list = array();
+ while ($fave->fetch()) {
+ $list[] = clone($fave);
+ }
+ $wrapper = new ArrayWrapper($list);
+ $c->set($key, $wrapper);
+ }
+ return $wrapper;
+ }