diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-07-22 12:15:49 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-07-22 12:15:49 -0400 |
commit | 81e6d50c533964899308e5745745381c340a1764 (patch) | |
tree | 1caaad20518b0786b09fd85f51268945974cf8fa /classes | |
parent | 64ed01f0aff569da2fd4ed589df9ed4ee9852cb7 (diff) |
blow off DB_DataObject joins, write SQL from scratch
darcs-hash:20080722161549-84dde-fedeed101bdef172f4a7aabf2278f1a2277a6d88.gz
Diffstat (limited to 'classes')
-rw-r--r-- | classes/User.php | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/classes/User.php b/classes/User.php index 1772b82e0..4f46653e4 100644 --- a/classes/User.php +++ b/classes/User.php @@ -128,23 +128,17 @@ class User extends DB_DataObject return true; } - - function noticesWithFriends() { + + function noticesWithFriends($offset=0, $limit=20) { $notice = new Notice(); - $notice->selectAs(); - - $subscription = new Subscription(); + $notice->query('SELECT notice.* ' . + 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed' . + 'WHERE subscription.subscriber = ' . $this->id . + 'ORDER BY created DESC, notice.id DESC ' . + 'LIMIT ' . $offset . ', ' . $limit); - $subscription->subscriber = $this->id; - - $notice->joinAdd($subscription); - $notice->whereAdd('notice.profile_id = subscription.subscribed'); - $notice->selectAs($subscription, 'sub_%'); - - $notice->orderBy('created DESC, notice.id DESC'); - return $notice; } } |