/** * Ajout des utilisateurs à la base de données * @param $user User instance de la classe User **/ public function add(User $user) { $q = $this->_db->prepare('INSERT INTO User SET name = :name, email = :email, password = :password, gender = :gender, description = :description'); $q->bindValue(':name', $user->name()); $q->bindValue(':email', $user->email()); $q->bindValue(':password', $user->password()); $q->bindValue(':gender', $user->gender()); $q->bindValue(':description', $user->description()); $q->execute(); $user->hydrate(['id' => $this->_db->lastInsertId()]); echo "Création du profil, avec succès"; }
/** * Ajout des utilisateurs à la base de données * @param $user User instance de la classe User **/ public function add(User $user) { $q = $this->_db->prepare('INSERT INTO User SET name = :name, email = :email, password = :password, gender = :gender, description = :description, nationalityId = :country, cityId = :city'); $q->bindValue(':name', $user->name()); $q->bindValue(':email', $user->email()); $q->bindValue(':password', $user->password()); $q->bindValue(':gender', $user->gender()); $q->bindValue(':description', $user->description()); $q->bindValue(':country', $user->nationalityId()); $q->bindValue(':city', $user->cityId()); $q->execute(); $user->setId($this->_db->lastInsertId()); echo _('Your account has been created'); }