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 }