public function add($userId) { $db = cl_mysql(); $db->insert('study', ['title' => $this->title, 'description' => $this->description]); $this->setId($db->getInsertId()); $db->insert('study_to_user', ['studyId' => $this->getId(), 'userId' => $userId]); }
public static function exists($id, $studyId) { $db = cl_mysql(); return $db->exists('model', ['AND' => ['studyId' => $studyId, 'id' => $id]]); }
public static function delete($id) { $db = cl_mysql(); $db->query("DELETE FROM `query` WHERE `id` = {$id}"); }
private function update() { $db = cl_mysql(); $db->update('user', ['email' => $this->email, 'password' => $this->password, 'name' => $this->name, 'surname' => $this->surname, 'organisation' => $this->organisation], ['id' => $this->id]); }
/** * @throws ActiveRecordException */ public function saveToTemp() { $db = cl_mysql(); $db->insert('poi_temp', ['id' => $this->id, 'url' => $this->url, 'name' => $this->name, 'attrs' => json_encode($this->attrs)]); }