Пример #1
0
 public function getUnique($id)
 {
     $requete = $this->dao->prepare('SELECT FNC_id as id, FNC_fk_FMC as auteurId, FMC_login as login, FNC_title as titre, FNC_content as contenu, FNC_dateadd as dateAjout, FNC_dateupdate as dateModif
                                 FROM t_for_newsc
                                 LEFT OUTER JOIN t_for_memberc ON FNC_fk_FMC = FMC_id
                                 WHERE FNC_id = :id');
     $requete->bindValue(':id', (int) $id, \PDO::PARAM_INT);
     $requete->execute();
     $data = $requete->fetch();
     if ($data) {
         $News = new News();
         $News->setId($data['id']);
         $News->setAuteurId($data['auteurId']);
         $News->setTitre($data['titre']);
         $News->setContenu($data['contenu']);
         $News->setDateAjout(new \DateTime($data['dateAjout']));
         $News->setDateModif(new \DateTime($data['dateModif']));
         $News->Membre = new Member(array('login' => $data['login']));
         return $News;
         /*
                $line=array();
               if($line=$stmt->fetch())
                   return new News($line)->__set('Member', new Member($line))
         $News->Member=85
         */
     }
     return null;
 }