select() ->where('user_id=?', $user->id); return $this->fetchRow($select); } public function getByCookie($cookie) { $select = $this->select() ->where('cookie=?', $cookie); return $this->fetchRow($select); } public function deleteForUser(Users_Model_User $user) { $where = $this->getAdapter()->quoteInto('user_id=?', $user->id); $this->delete($where); } public function generateCookieId(Users_Model_User $user) { do { $cookie = md5($user->username . rand(1, 1000)); $select = $this->select() ->where('cookie=?', $cookie); $row = $this->fetchRow($select); } while($row); return $cookie; } }