Ejemplo n.º 1
0
 public function getAnimals()
 {
     $db = DbManager::getPDO();
     $req = "SELECT * FROM Animal an, Adopt ad WHERE an.idAnimal=ad.idAnimal AND ad.idUser="******"";
     $res = $db->query($query);
     for ($i = 0; $i < count($res); $i++) {
         $animal = Animal::getAnimalArrayFromFetch($res[$i]);
         $listUsersAnimals[$animal['idAnimal']] = $animal;
     }
     return $listUsersAnimals;
 }
Ejemplo n.º 2
0
 /**
  * @return la liste des animaux à l'adoption
  */
 public static function getHomelessAnimals()
 {
     $db = DbManager::getPDO();
     $query = "SELECT * FROM Animal WHERE idState='" . self::$STATE_ADOPTION . "';";
     $res = $db->query($query)->fetchAll();
     for ($i = 0; $i < count($res); $i++) {
         $animal = Animal::getAnimalArrayFromFetch($res[$i]);
         $listAnimals[$animal['idAnimal']] = $animal;
     }
     return $listAnimals;
 }
Ejemplo n.º 3
0
 public function getAnimals()
 {
     $db = DbManager::getPDO();
     $query = "SELECT * FROM Animal WHERE idShelter = " . $this->idShelter . " AND idState = " . Animal::$STATE_ADOPTION . ";";
     $res = $db->query($query)->fetchAll();
     for ($i = 0; $i < count($res); $i++) {
         $animal = Animal::getAnimalArrayFromFetch($res[$i]);
         $listAnimals[$animal['idAnimal']] = $animal;
     }
     return $listAnimals;
 }