/** * Inserts or updates File entry. * * @param FileModel $model */ public function save(TopicModel $model) { if ($model->getId()) { $this->db()->update('forum_topics')->values(array('topic_id' => $model->getTopicId()))->where(array('id' => $model->getId()))->execute(); } else { $this->db()->insert('forum_topics')->values(array('topic_title' => $model->getTopicTitle(), 'text' => $model->getText(), 'topic_id' => $model->getTopicId(), 'forum_id' => $model->getForumId(), 'creator_id' => $model->getCreatorId(), 'type' => $model->getType(), 'date_created' => $model->getDateCreated()))->execute(); $this->last_insert_id = $this->db()->getLastInsertId(); } }