Ejemplo n.º 1
0
 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]);
 }
Ejemplo n.º 2
0
 public static function exists($id, $studyId)
 {
     $db = cl_mysql();
     return $db->exists('model', ['AND' => ['studyId' => $studyId, 'id' => $id]]);
 }
Ejemplo n.º 3
0
 public static function delete($id)
 {
     $db = cl_mysql();
     $db->query("DELETE FROM `query` WHERE `id` = {$id}");
 }
Ejemplo n.º 4
0
 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]);
 }
Ejemplo n.º 5
0
 /**
  * @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)]);
 }