Ejemplo n.º 1
0
 /**
  * Inserts or updates dialog entry.
  *
  * @param DialogModel $model
  */
 public function save(DialogModel $model)
 {
     $fields = array('user_id_fk' => $model->getId(), 'reply' => $model->getText(), 'time' => $model->getTime(), 'c_id_fk' => $model->getCId(), 'user_one' => $model->getUserOne(), 'user_two' => $model->getUserTwo());
     if (!empty($fields['user_one']) or !empty($fields['user_two'])) {
         $this->db()->insert('users_dialog')->values($fields)->execute();
         return;
     } else {
         $this->db()->insert('users_dialog_reply')->values($fields)->execute();
     }
     return;
 }