Beispiel #1
0
 public function save(Article $article)
 {
     $articleData = array('title' => $article->getTitle(), 'content' => $article->getContent());
     if ($article->getId()) {
         $this->db->update('article', $articleData, array('id' => $article->getId()));
     } else {
         $this->db->insert('article', $articleData);
         $id = $this->getDb()->lastInsertId();
         $article->setId($id);
     }
 }