public function update(SCategory $sCategory) { $id = $sCategory->getId(); $title = $this->db->quote($title->getTitle()); $content = $this->db->quote($content->getContent()); $idAuthor = $_SESSION['id']; $query = ' UPDATE scategory SET title =' . $title . ', content =' . $content . ', $idAuthor =' . $idAuthor . ' WHERE id=' . $id; $res = $this->db->exec($query); if ($res) { $id = $this->db->lastInsertId(); if ($id) { return $this->findById($id); } else { throw new Exception('Internal server Error'); } } }
public function setSCategory(SCategory $sCategory) { $this->id_scategory = $sCategory->getId(); return true; }