Пример #1
0
 /**
  *	Returnerar id på posten 
  */
 public function saveBloggPost(\blogg\model\blogg\Post $post)
 {
     if (!$post->isValid()) {
         return;
     }
     if ($post->getId() === 0) {
         return intval($this->bloggRepository->savePost($post));
     }
     return intval($this->bloggRepository->updatePost($post));
 }
Пример #2
0
 public function updatePost(\blogg\model\blogg\Post $post)
 {
     $titel = $post->getTitel();
     $text = $post->getText();
     $time = $post->getTime();
     $id = $post->getId();
     $sql = "UPDATE " . $this->table . " SET titel = :titel, text = :text, time = :time WHERE id = :id";
     $params = array(":titel" => $titel, ":text" => $text, ':time' => $time, ':id' => $id);
     $this->query($sql, $params, true);
     return $id;
 }