1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
public function modifierAction(){
$user = $this->get('security.context')->getToken()->getUser();
$em = $this->getDoctrine()->getEntityManager();
$u = $em->getRepository('PublicBundle:User')->find($user->getid());
$form = $this->createForm(new UserForm(),$u);
$req = $this->get('request');
if($req->getMethod() == 'POST')
{
$form->bindRequest($req);
if($form->isValid() )
{
$em->persist($u);
$em->flush();
return $this->redirect($this->generateUrl('UserBundle_homepage'));
}
}
return $this->render('UserBundle:Default:profil.html.twig', array(
'user' => $form->createView()
));
} |
Partager