public function add(Personnage $perso)
 {
     $q = $this->_db->prepare('INSERT INTO personnages SET nom = :nom');
     $q->bindValue(':nom', $perso->getNom());
     $q->execute();
     $perso->hydrate(["id" => $this->_db->lastInsertId(), "degats" => 0]);
 }
 public function addPersonnage(Personnage $perso)
 {
     $req = $this->bdd->prepare('INSERT INTO Personnages_v2
                                          SET nom    = :nom,
                                              type   = :type
                                ');
     // prepare INSERT request
     $req->bindValue(':nom', $perso->getNom(), PDO::PARAM_STR);
     // Assign Value Personnage
     $req->bindValue(':type', $perso->getType(), PDO::PARAM_STR);
     // Assign Value Type
     $req->execute();
     // execute request
     // hydrate personnage with id and degats - initial = 0
     $perso->hydrate(['id' => $this->bdd->lastInsertId(), 'degats' => 0, 'atout' => 0]);
     $req->closeCursor();
     // close request
 }
 public function update(Personnage $personnage)
 {
     $request = $this->db->prepare('
         UPDATE 
                 personnage
         SET 
                 degat = :degat,
                 experience = :experience,
                 nom = :nom,
                 nombreAttaque = :nombreAttaque,
                 mouvement = :mouvement,
                 pointDeVie = :pointDeVie,
                 planId = :planId,
                 pointInvestissement = :pointInvestissement,
                 positionX = :positionX,
                 positionY = :positionY,
                 tourDeJeu = :tourDeJeu,
                 prochainTourDeJeu = :prochainTourDeJeu
         WHERE id = :id');
     $request->bindValue(':degat', $personnage->getDegat());
     $request->bindValue(':experience', $personnage->getExperience());
     $request->bindValue(':id', $personnage->getId());
     $request->bindValue(':nom', $personnage->getNom());
     $request->bindValue(':nombreAttaque', $personnage->getNombreAttaque());
     $request->bindValue(':mouvement', $personnage->getMouvement());
     $request->bindValue(':planId', $personnage->getPlanId());
     $request->bindValue(':pointInvestissement', $personnage->getPointInvestissement());
     $request->bindValue(':pointDeVie', $personnage->getPointDeVie());
     $request->bindValue(':positionX', $personnage->getPositionX());
     $request->bindValue(':positionY', $personnage->getPositionY());
     $request->bindValue(':tourDeJeu', $personnage->getTourDeJeu());
     $request->bindValue(':prochainTourDeJeu', $personnage->getProchainTourDeJeu());
     $request->execute();
 }