function update(\info\domain\DomainObject $object) { $values = array($object->getTitle(), $object->getType(), $object->getText(), $object->getImg(), $object->getId()); $result = $this->updateStmt->execute($values); if (!$result) { throw new \Exception("Ошибка базы данных. Запрос на обновление новости не прошел"); } }
function __construct($id, $title, $text, $author, $type, $views, $date, $img) { parent::__construct($id, $title, $text); $this->author = $author; $db = \database\Db::getInstance(); $pdo = $db->getDb(); $category = new CategoryMapper($pdo); $this->type = $category->find($type); $this->views = $views; $this->date = $date; $this->img = $img; }