Esempio n. 1
0
 public function save(Model_Comment $comment)
 {
     if ($comment->id) {
         $where[] = 'id = ' . $comment->id;
         $this->_db->update('comments', $comment->toArray(), $where);
     } else {
         $this->_db->insert('comments', $comment->toArray());
         $comment->id = $this->_db->lastInsertId();
     }
     return $comment;
 }