private function quickSignup(Request $request)
 {
     if ($request->getMethod() == "POST") {
         $em = $this->getDoctrine()->getManager();
         $validator = $this->get('validator');
         $userSignup = new UserSignup();
         $result = $userSignup->setRequest($request)->setEntityManager($em)->setValidator($validator)->execute();
         return $result;
     }
 }
Beispiel #2
0
 /**
  * @Route("/profile", name="userProfile")
  * @Template()
  */
 public function profileAction(Request $request)
 {
     $session = $request->getSession();
     $userType = $session->get("userType", "");
     $userId = $session->get("id", 0);
     if (trim($userType) == "") {
         return $this->redirect($this->generateUrl("userLogin"));
     }
     $em = $this->getDoctrine()->getManager();
     $userInfo = $em->getRepository('BackendUserBundle:Users')->find($userId);
     if (!$userInfo) {
         throw $this->createNotFoundException('Unable to find Post entity.');
     }
     if ($request->getMethod() == "POST") {
         $validator = $this->get('validator');
         $userSignup = new UserSignup();
         $result = $userSignup->setRequest($request)->setEntityManager($em)->setValidator($validator)->setUser($userInfo)->execute();
         if ($result["success"] == 1) {
             $session->getFlashBag()->add('success', "Your Profile has been updated successfully.");
         } else {
             $session->getFlashBag()->add('error', "Please enter all required fields.");
         }
     }
     $queryBuilder = $em->createQueryBuilder();
     $query = $queryBuilder->select("C")->from("BackendUserBundle:Country", "C")->getQuery();
     $countryList = $query->getArrayResult();
     //echo "<pre/>";print_r($userInfo);
     return $this->render('BackendUserBundle:Admin:profile.html.twig', array("userInfo" => $userInfo, 'countryList' => $countryList));
 }