예제 #1
0
 public function consumerRegistrationAction(Request $request)
 {
     $repository = $this->getDoctrine()->getRepository('SalonSolutionWebBundle:SalonsolutionsSalon');
     $salonOwners = $repository->findAll();
     //echo "<pre>"; print_r($Salons) ; die;
     //$advertisements = $this->getAdvertisementsAction($salonId);
     if ($request->getMethod() == 'POST') {
         $firstName = $request->get("firstName");
         $lastName = $request->get("lastName");
         $email = $request->get("email");
         $username = $request->get("username");
         $password = $request->get("password");
         $country = $request->get("country");
         $state = $request->get("state");
         $city = $request->get("city");
         $address = $request->get("address");
         $zip = $request->get("zip");
         $mobile = $request->get("mobile");
         $landline = $request->get("landline");
         $basePath = $this->getBasePathAction();
         $photo = $_FILES['photo']['name'];
         $ranPhotoUpload = rand(1, 10000);
         $targetFilePhoto = $basePath . "/" . $this->container->getParameter('gbl_uploadPath_consumers') . $ranPhotoUpload . $photo;
         move_uploaded_file($_FILES['photo']['tmp_name'], $targetFilePhoto);
         //$salonId = $request->get("ownerId");
         $arrServerName = explode('.salonsolutions.ca', $_SERVER['SERVER_NAME']);
         $salonDomain = $arrServerName[0];
         //echo "<pre>"; print_r($salonDomain) ; die;
         if ($salonDomain == 'tanonline') {
             return $this->redirect($this->generateUrl('salon_solution_web_index'));
         }
         //echo $salonDomain."<PRE>";print_r($_SERVER);die;
         $params = array("domainName" => $salonDomain);
         $salonDetail = $this->getSalonAction($params);
         foreach ($salonDetail as $salonDetail) {
         }
         $salonId = $salonDetail['id'];
         $salonOwnerId = $salonDetail['ownerId'];
         //echo "<pre>"; print_r($salonOwnerId) ; die;
         $consumer = new SalonsolutionsUser();
         $consumer->setFirstName($firstName);
         $consumer->setLastName($lastName);
         $consumer->setEmail($email);
         $consumer->setUsername($username);
         $consumer->setPassword(md5($password));
         $consumer->setAddress($address);
         $consumer->setCountry($country);
         $consumer->setState($state);
         $consumer->setCity($city);
         $consumer->setZip($zip);
         $consumer->setMobile($mobile);
         $consumer->setLandline($landline);
         $consumer->setPhoto($ranPhotoUpload . $photo);
         $consumer->setParentId($salonId);
         $consumer->setSalonId($salonId);
         $consumer->setSalonOwnerId($salonOwnerId);
         $consumer->setType('3');
         $consumer->setStatus('1');
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($consumer);
         $em->flush();
         // next ---------> table insert
     }
     return $this->render('SalonSolutionWebBundle:Home:consumer_register.html.twig', array('salonOwners' => $salonOwners));
 }
 public function registerCustomerAction(Request $request)
 {
     if ($request->getMethod() == 'POST') {
         $firstName = $request->get("firstName");
         $lastName = $request->get("lastName");
         $email = $request->get("email");
         $username = $request->get("username");
         $password = $request->get("password");
         $salonName = $request->get("salonName");
         $domain = $request->get("domain");
         $address = $request->get("address");
         $city = $request->get("city");
         $state = $request->get("state");
         $country = $request->get("country");
         $zip = $request->get("zip");
         $basePath = $this->getBasePathAction();
         $photo = $_FILES['photo']['name'];
         $targetFilePhoto = $basePath . "/" . $this->container->getParameter('gbl_uploadPath_customers') . $photo;
         move_uploaded_file($_FILES['photo']['tmp_name'], $targetFilePhoto);
         $logo = $_FILES['logo']['name'];
         $targetFileLogo = $basePath . "/" . $this->container->getParameter('gbl_uploadPath_salons') . $logo;
         move_uploaded_file($_FILES['logo']['tmp_name'], $targetFileLogo);
         $customer = new SalonsolutionsUser();
         $customer->setFirstName($firstName);
         $customer->setLastName($lastName);
         $customer->setEmail($email);
         $customer->setUsername($username);
         $customer->setPassword(md5($password));
         /*$customer->setAddress($address);
         		$customer->setCity($city);
         		$customer->setState($state);
         		$customer->setCountry($country);
         		$customer->setZip($zip);*/
         $customer->setPhoto($photo);
         $customer->setType('2');
         $customer->setStatus('0');
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($customer);
         $em->flush();
         // next ---------> table insert
         $customerId = $customer->getId();
         $salon = new SalonsolutionsSalon();
         $salon->setName($salonName);
         $salon->setAddress($address);
         $salon->setDomain($domain);
         $salon->setCity($city);
         $salon->setState($state);
         $salon->setCountry($country);
         $salon->setZip($zip);
         $salon->setLogo($logo);
         $salon->setStatus('0');
         $salon->setOwnerId($customerId);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($salon);
         $em->flush();
     }
     /*	if ($request->isMethod('POST')) {		
     					
     					$forms->bind($request);		     					 //   for entry data code process by this code
     					
     					$data = $forms->getData(); 	
     													
     					$password = $data->password;
     					$data->password	= md5($password);	
     					//echo "<pre>"; print_r($_SERVER);die;
     					//echo $this->get('request')->getBaseUrl();die;
     					$basePath = $this->getBasePathAction();
     					$fileName = $_FILES['SalonsolutionsUser']['name']['photo'];
     					$data->photo = $fileName;	
     					$targetFile = $basePath."/".$this->container->getParameter('gbl_uploadPath_customers').$fileName;	
     						
     					move_uploaded_file($_FILES['SalonsolutionsUser']['tmp_name']['photo'], $targetFile);
     			
     									
     																		 
     						$em = $this->getDoctrine()->getEntityManager();
     						$em->persist($data);
     						$em->flush();     
     							
     						$lastinsertd= $data->getId();	 					// this is get the last inser id symfony method
     						  
     																				echo "<pre>"; print_r($lastinsertd); 	
     							//$id = 	->set('userId', $salonid); 
     					
     					
     					
     				//	return $this->redirect($this->generateUrl('salon_solution_web_index'));
     					} */
     return $this->render('SalonSolutionWebBundle:Home:user_register.html.twig');
 }