Пример #1
0
 public function save(PostModel $model)
 {
     if ($model->getId()) {
         $this->db()->update('forum_posts')->values(array('topic_id' => $model->getTopicId()))->where(array('id' => $model->getId()))->execute();
     } else {
         $this->db()->insert('forum_posts')->values(array('text' => $model->getText(), 'topic_id' => $model->getTopicId(), 'user_id' => $model->getUserId(), 'forum_id' => $model->getForumId(), 'date_created' => $model->getDateCreated()))->execute();
     }
 }