| Conditions | 3 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function register(Request $request, UserPasswordEncoderInterface $passwordEncoder) |
||
| 22 | { |
||
| 23 | $user = new User(); |
||
| 24 | $form = $this->createForm(UserType::class, $user); |
||
| 25 | |||
| 26 | $form->handleRequest($request); |
||
| 27 | if ($form->isSubmitted() && $form->isValid()) { |
||
| 28 | |||
| 29 | $password = $passwordEncoder->encodePassword($user, $user->getPlainPassword()); |
||
| 30 | $user->setPassword($password); |
||
| 31 | |||
| 32 | $entityManager = $this->getDoctrine()->getManager(); |
||
| 33 | $entityManager->persist($user); |
||
| 34 | $entityManager->flush(); |
||
| 35 | |||
| 36 | return $this->redirectToRoute('login'); |
||
| 37 | } |
||
| 38 | $form->getErrors(); |
||
| 39 | |||
| 40 | return $this->render( |
||
| 41 | 'user/registration/register.html.twig', |
||
| 42 | [ |
||
| 43 | 'form' => $form->createView() |
||
| 44 | ] |
||
| 47 | } |