Example #1
0
 public function update($id, PageBinding $page)
 {
     if (!Validator::validatePageCreationInformation($page)) {
         return;
     }
     // TODO: validatePageUpdateInformation().
     $query = "UPDATE pages" . " SET title = :title, content = :content, active = :active" . " WHERE id = :id";
     $stmt = $this->db()->prepare($query);
     $result = $stmt->execute([':title' => $page->title, ':content' => $page->content, ':active' => $page->active, ':id' => $id]);
     if ($result) {
         Session::flash('flash_messages', Communicator::PAGE_SUCCESSFULLY_EDITED);
         return true;
     }
     Session::flash('flash_messages', Communicator::PAGE_EDITING_FAIL);
     return false;
 }