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)); }