/** * @param $login * @param $password * @return \Symfony\Component\HttpFoundation\Response * * @Route("/register/{login}/{password}/{phone}/") */ public function registerAction($login, $password, $phone) { $em = $this->getDoctrine()->getManager(); $formatService = $this->get('server.format_service'); $fs = new Filesystem(); $user = new User(); $user->setUsername($login); $user->setPassword(password_hash($password, PASSWORD_BCRYPT)); $user->setPhoneNumber($formatService->formatPhone($phone)); try { $em->persist($user); $em->flush(); } catch (UniqueConstraintViolationException $e) { return $this->NTRender(array('response' => 0, 'message' => 'Utilisateur existant')); } $fs->mkdir('Files/Profil/' . $user->getId(), 0777); return $this->NTRender(array('response' => 1, 'message' => 'Inscription effectuée')); }