/**
  * Renvoie les Infrastructures liés au Partie fourni
  * @var Partie $partie
  * @return InfrastructureCollection
  */
 public static function getByPartie(Partie $partie)
 {
     $req = "SELECT * from infrastructure WHERE idHexa IN (SELECT hexa.idHexa FROM hexa WHERE hexa.idPartie = " . $partie->getIdPartie() . ")";
     return DbHandler::collFromQuery($req, 'Infrastructure', 'InfrastructureCollection');
 }
Пример #2
0
 /**
  * Renvoie les Batiments à modifier pour la partie fournie
  * @var Partie $partie
  * @return BatimentCollection
  */
 public static function getAModifierDePartie(Partie $partie)
 {
     $req = "SELECT * from batiment WHERE idHexa IN (SELECT hexa.idHexa FROM hexa WHERE hexa.idPartie = " . $partie->getIdPartie() . ") AND enConstruction in (-1,1) ORDER BY niveau ASC";
     return DbHandler::collFromQuery($req, 'Batiment', 'BatimentCollection');
 }
Пример #3
0
 /**
  * Renvoie les Qgs liés au Partie fourni
  * @var Partie $partie
  * @return QgCollection
  */
 public static function getByPartie(Partie $partie)
 {
     $req = "SELECT * from qg WHERE idJoueur IN (SELECT joueur.IdJoueur FROM joueur WHERE joueur.idPartie = " . $partie->getIdPartie() . ")";
     return DbHandler::collFromQuery($req, 'Qg', 'QgCollection');
 }
Пример #4
0
 /**
  * Renvoie les Joueur liées à un Partie
  * @param Partie $partie
  * @return JoueurCollection
  */
 public static function getByPartie(Partie $partie)
 {
     $req = "SELECT * FROM joueur WHERE idPartie = '" . $partie->getIdPartie() . "';";
     return DbHandler::collFromQuery($req, 'Joueur', 'JoueurCollection');
 }
Пример #5
0
 /**
  * Renvoie les Unites à modifier pour la partie fournie
  * @var Partie $partie
  * @return UniteCollection
  */
 public static function getAModifierDePartie(Partie $partie)
 {
     $req = "SELECT * from unite WHERE idHexaConstruit IN (SELECT hexa.idHexa FROM hexa WHERE hexa.idPartie = " . $partie->getIdPartie() . ") AND enConstruction in (-1,1);";
     return DbHandler::collFromQuery($req, 'Unite', 'UniteCollection');
 }
Пример #6
0
 /**
  * Renvoie le joueur de l'utilisateur lié à une partie
  * @param Partie $partie
  * @return Joueur
  */
 public function joueurDePartie(Partie $partie)
 {
     foreach ($this->getJoueurs() as $joueur) {
         /** @var Joueur $joueur */
         if ($joueur->getIdPartie() == $partie->getIdPartie()) {
             return $joueur;
         }
     }
     return null;
 }