public function store($tweet, $author) { if (!$tweet->getId()) $tweet->createId($author); HypertableConnection::insert('tweet', $tweet->getId(), 'message', $tweet->getMessage()); $u=UserTable::load($author); $u->sendTweet($tweet); return true; }
public function store($profile) { HypertableConnection::insert('profile', $profile->getId(), 'display_name', $profile->getDisplayName()); HypertableConnection::insert('profile', $profile->getId(), 'password', $profile->getPassword()); HypertableConnection::insert('profile', $profile->getId(), 'email', $profile->getEmail()); HypertableConnection::insert('profile', $profile->getId(), 'avatar', $profile->getAvatar()); HypertableConnection::insert('profile', $profile->getId(), 'location', $profile->getLocation()); HypertableConnection::insert('profile', $profile->getId(), 'bio', $profile->getBio()); HypertableConnection::insert('profile', $profile->getId(), 'webpage', $profile->getWebpage()); }
public function sendTweet($tweet) { $tid=$tweet->getId(); HypertableConnection::insert('user', $this->_id, "my_stream", $tid); HypertableConnection::insert('user', $this->_id, 'my_stream_count', 1); // store in follow_stream, otherwise the user's own tweets would not // be displayed in the timeline HypertableConnection::insert('user', $this->_id, 'follow_stream', $tid); // get followers $result=HypertableConnection::query("SELECT followers FROM ". "user WHERE ROW='".$this->_id."'"); // foreach follower: store tweet id in their "follow-stream" foreach ($result->cells as $cell) { $qualifier=$cell->key->column_qualifier; HypertableConnection::insert('user', $qualifier, 'follow_stream', $tid); HypertableConnection::insert('user', $qualifier, 'follow_stream_count', '+1'); } }