public function recupUser() { // si le champs num client est rempli if (isset($_POST['num-client']) && !empty($_POST['num-client'])) { $userId = $_POST['num-client']; } else { $this->redirectToRoute('create_user'); } if (!is_numeric($userId)) { $this->redirectToRoute('create_user'); } // je vérifie si l'id existe en DB $userManager = new \Manager\UserManager(); $idExist = $userManager->idExists($userId); // si oui je recup les infos if ($idExist) { $currentUser = $userManager->find($userId); // je verifie si les champs nom et prenom sont remplis if (isset($_POST['nom']) && isset($_POST['prenom']) && !empty($_POST['nom']) && !empty($_POST['prenom'])) { $nom = trim($this->minusculesSansAccents($_POST['nom'])); $prenom = trim($this->minusculesSansAccents($_POST['prenom'])); $nomDB = $this->minusculesSansAccents($currentUser['nom']); $prenomDB = $this->minusculesSansAccents($currentUser['prenom']); if ($nom == $nomDB && $prenom == $prenomDB) { $this->show('user/recup_user', ['currentUser' => $currentUser]); } } $this->redirectToRoute('create_user'); } $this->redirectToRoute('create_user'); }