Example #1
0
 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("Ошибка базы данных. Запрос на обновление новости не прошел");
     }
 }
Example #2
0
File: News.php Project: Klym/sp-dnr
 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;
 }