Пример #1
0
 public static function deleteSchedules($tournament)
 {
     $req = DataBase::getInstance()->prepare('DELETE FROM tournament_schedule WHERE tournament = :id');
     $req->bindvalue('id', $tournament, PDO::PARAM_INT);
     $req->execute();
     $req->closeCursor();
 }
Пример #2
0
 public static function getTeamsFromUser($id)
 {
     $teams = array();
     $req = DataBase::getInstance()->prepare('SELECT id, name, description FROM team LEFT JOIN team_player ON team = id WHERE player = :id');
     $req->bindvalue('id', $id, PDO::PARAM_INT);
     $req->execute();
     while ($datas = $req->fetch()) {
         $team = new Team();
         $team->hydrate($datas);
         $team->loadPlayers();
         $team->loadTournaments();
         $teams[] = $team;
     }
     $req->closeCursor();
     return $teams;
 }
Пример #3
0
 public static function getGames()
 {
     $games = array();
     $req = DataBase::getInstance()->prepare('SELECT id, name, description, cover FROM game');
     $req->execute();
     while ($datas = $req->fetch()) {
         $game = new Game();
         $game->hydrate($datas);
         $games[] = $game;
     }
     $req->closeCursor();
     return $games;
 }
Пример #4
0
 public static function getTournamentsFromTeam($id)
 {
     $tournaments = array();
     $req = DataBase::getInstance()->prepare('SELECT id, name, description, game FROM tournament LEFT JOIN team_inscription ON tournament = id WHERE team = :id');
     $req->bindvalue('id', $id, PDO::PARAM_INT);
     $req->execute();
     while ($datas = $req->fetch()) {
         $toutnament = new Tournament(Game::getGame($datas['game']));
         $toutnament->hydrate($datas);
         $toutnament->loadSchedules();
         $tournaments[] = $toutnament;
     }
     $req->closeCursor();
     return $tournaments;
 }