public static function save($userDoc) { if (!$userDoc->email) { return false; } //Ensure that type is always user $userDoc->type = 'user'; $result = CouchDB::client()->key($userDoc->email)->getView('users', 'by-email'); if (count($result->rows)) { return false; } CouchDB::client()->storeDoc($userDoc); return self::byEmail($userDoc->email); }
public function loadFromSID($SID) { $result = CouchDB::client()->key($SID)->include_docs(true)->getView("session", 'all'); if (count($result->rows) > 0) { $this->document = current($result->rows)->doc; } if (!$this->document) { $this->document = new stdClass(); } $this->document->SID = $SID; $this->document->type = 'session'; $this->document->expires = SessionHandler::instance()->getExpires(); return $this; }
public static function get($projectId) { return CouchDB::client()->getDoc($projectId); }