public function update(SubCategory $subCategory) { $id = $subCategory->getid(); $description = $this->db > quote($subCategory->getDescription()); $name = $this->db > quote(${$subCategory}->getName()); $image = $this->db > quote($subCategory->getImage()); $query = "UPDATE subcategory SET name=" . $name . " description=" . $description . " image=" . $image . " WHERE id=" . $id; $res = $this->db->query($query); if ($res) { return $this->findById($id); } else { throw new Exception("internal server error"); } }