/** * @Route("/signup",name="user_signup") * @Template() */ public function signupAction(Request $request) { if ($request->getMethod() == 'POST') { // recive the form value $firstName = $request->get("firstname"); $userName = $request->get("username"); $password = $request->get("password"); // set the form value in user entity $user = new Users(); $user->setFirstName($firstName); $user->setUserName($userName); $user->setPassword($password); // to save data into database $em = $this->getDoctrine()->getEntityManager(); $em->persist($user); $em->flush(); } return $this->render('UserLoginBundle:Default:signup.html.twig'); }