private function loadPlayers() { $req = DataBase::getInstance()->prepare('SELECT id FROM user_data LEFT JOIN team_player ON player = id WHERE team = :id'); $req->bindvalue('id', $this->id, PDO::PARAM_INT); $req->execute(); while ($datas = $req->fetch()) { $this->players[] = User::getUser($datas['id']); } $req->closeCursor(); }
public static function getUser($id) { $req = DataBase::getInstance()->prepare('SELECT id, login, password, name, surname, mail FROM user_data WHERE id = :id'); $req->bindvalue('id', $id, PDO::PARAM_INT); $req->execute(); $datas = $req->fetch(); $user = new User(); $user->hydrate($datas); $req->closeCursor(); return $user; }
Tournament::saveTournament($l4dTour); //Test des elements utilisés dans le frontend $gamesList = Game::getGames(); $countGames = Game::countGames(); $tourList = Tournament::getTournaments(); $countTour = Tournament::countTournaments(); //Autres test du moteur, non implanté dans le frontend $me = new User(); $me->setName('Karl'); $me->setSurname('Woditsch'); $me->setMail('*****@*****.**'); $me->setLogin(uniqid()); $me->setPassword('1234'); User::saveUser($me); $userList = User::getUsers(); $countUsers = User::countUsers(); $team = new Team(); $team->setName('Les winneurs'); $team->setDescription('Equipe de test'); $team->addPlayer($me); $team->addTournament($bf3Tour); $team->addTournament($l4dTour); //Team::saveTeam($team); $teamList = Team::getTeams(); $countTeams = Team::countTeams(); $myTeams = Team::getTeamsFromUser($me->getId()); echo 'Succes'; echo 'INIT TEST'; var_dump($bf3); var_dump($gw2); var_dump($l4d);