1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Controller;
- use Doctrine\ORM\EntityManagerInterface;
- use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Routing\Annotation\Route;
- class ProfilController extends AbstractController
- {
- /**
- * @Route("/profil/", name="user_profil")
- */
- public function monProfilAction(Request $request, EntityManagerInterface $em)
- {
- $user = $this->getUser();
- $form = $this->createForm('App\Form\UserEditProfilType', $user);
- $form->handleRequest($request);
- if ($form->isSubmitted() && $form->isValid())
- {
- $user = $form->getData();
- $em->flush();
- $this->addFlash('success', "Votre profil a été modifié");
- }
- return $this->render('profil/monprofil.html.twig', array (
- 'form' => $form->createView()
- ));
- }
- }
|