Example #1
0
 protected function modify(Page $page)
 {
     $requete = $this->dao->prepare('UPDATE pages SET autor = :autor, title = :title, slug = :slug, content = :content, template = :template, lastUpdateDate = NOW() WHERE id = :id');
     $requete->bindValue(':title', ucfirst($page->title()), \PDO::PARAM_STR);
     $requete->bindValue(':autor', $page->autor()->id(), \PDO::PARAM_INT);
     $requete->bindValue(':slug', strtolower(trim(preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|copy|th|tilde|uml);~i', '$1', htmlentities($page->title(), ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-')), \PDO::PARAM_STR);
     $requete->bindValue(':content', $page->content(), \PDO::PARAM_STR);
     $requete->bindValue(':template', $page->template(), \PDO::PARAM_STR);
     $requete->bindValue(':id', $page->id(), \PDO::PARAM_INT);
     $requete->execute();
 }