Ejemplo n.º 1
0
 public function findAll()
 {
     $liste = array();
     $cnx = DataBase::getInstance();
     $pstmt = $cnx->prepare("SELECT * FROM alerts ORDER BY active=1 DESC");
     $pstmt->execute();
     while ($result = $pstmt->fetch(PDO::FETCH_OBJ)) {
         $p = new Alert();
         $p->setId($result->id);
         $p->setTitle($result->title);
         $p->setText($result->text);
         $p->setDate($result->date);
         $p->setActive($result->active);
         array_push($liste, $p);
     }
     $pstmt->closeCursor();
     DataBase::close();
     return $liste;
 }