public function fullsignupAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $repository = $em->getRepository("LoginLoginBundle:Users");
     $session = $request->getSession();
     $admin = $session->get('token');
     if ($request->getMethod() == 'POST' && ($admin->getRole() == 'Admin' || $admin->getRole() == 'Master Admin')) {
         $profileimage = $request->files->get('img');
         if ($profileimage != null && $profileimage->isValid()) {
             $profilestore = $profileimage->move("bundles/loginlogin/images", $request->get('username') . "." . split('/', $profileimage->getMimeType())[1]);
         } else {
             $profilestore = '';
         }
         $username = $request->get('username');
         $firstname = $request->get('firstname');
         $lastname = $request->get('lastname');
         $email = $request->get('email');
         $dob = $request->get('dob');
         $officetel = $request->get('officetel');
         $mobile = $request->get('mobile');
         $jobtitle = $request->get('jobtitle');
         $address1 = $request->get('address1');
         $address2 = $request->get('address2');
         $city = $request->get('city');
         $state = $request->get('state');
         $postalcode = $request->get('postalcode');
         $empstartdate = $request->get('empstartdate');
         $commisionoriginator = $request->get('commisionoriginator');
         $commisionnonoriginator = $request->get('commisionnonoriginator');
         $annualdraw = $request->get('annualdraw');
         $earninggoals = $request->get('earninggoals');
         $profilenote = $request->get('profilenote');
         $linkedin = $request->get('linkedin');
         $twitter = $request->get('twitter');
         $role = 'Regular';
         $status = 'Active';
         $key = '';
         $keys = array_merge(range(0, 9), range('a', 'z'));
         for ($i = 0; $i < 10; $i++) {
             $key .= $keys[array_rand($keys)];
         }
         $password = sha1($key);
         $adminname = $admin->getUsername();
         $adminuser = $repository->findOneBy(array('username' => $adminname));
         $industry = $adminuser->getIndustry();
         $companysize = $adminuser->getCompanysize();
         $companyname = $adminuser->getCompanyname();
         $user = new Users();
         $user->setUsername($username);
         $user->setFirstname($firstname);
         $user->setLastname($lastname);
         $user->setEmail($email);
         $user->setDob($dob);
         $user->setTelephoneoffice($officetel);
         $user->setTelephonemobile($mobile);
         $user->setJobtitle($jobtitle);
         $user->setCompanyname($companyname);
         $user->setAddress1($address1);
         $user->setAddress2($address2);
         $user->setCity($city);
         $user->setState($state);
         $user->setPostalcode($postalcode);
         $user->setContractstartdate($empstartdate);
         $user->setCommissionoriginator($commisionoriginator);
         $user->setCommissionnonoriginator($commisionnonoriginator);
         $user->setAnnualdraw($annualdraw);
         $user->setEarninggoal($earninggoals);
         $user->setProfilenote($profilenote);
         $user->setLinkedin($linkedin);
         $user->setTwitter($twitter);
         $user->setRole($role);
         $user->setIndustry($industry);
         $user->setCompanysize($companysize);
         $user->setPassword($password);
         $user->setStatus($status);
         $user->setImage($profilestore);
         $user->setUserview(10);
         $user->setContactview(10);
         $user->setOpportunityview(10);
         $fullname = $adminuser->getFirstname() . " " . $adminuser->getLastname();
         try {
             $em->persist($user);
             $mailer = $this->get('mailer');
             $message = $mailer->createMessage()->setSubject('Hello Email')->setFrom('*****@*****.**')->setTo($email)->setBody("welcome to pipeline. your username is " . $username . " and your password is " . $key . ".");
             $mailer->send($message);
             $em->flush();
             $userArray = $this->getUserArray($admin);
             return $this->redirectToRoute('settings_pipelinesetup');
             //return $this->render('LoginLoginBundle:Default:manageUsersV2.html.twig', array('name' => $admin->getUsername(), 'userArray' => $userArray, 'role' => $admin->getRole(), 'fullname' => $fullname, 'manageview' => $adminuser->getUserView(), 'successmsg' => 'Regular User Created'));
         } catch (Doctrine\ORM\ORMInvalidArgumentException $e) {
             return $this->render('LoginLoginBundle:Default:addUsers.html.twig', array('name' => $admin->getUsername(), 'role' => $admin->getRole(), 'fullname' => $fullname, 'errormsg' => 'Invalid Arguments. Try Again'));
         }
     } else {
         return $this->render('LoginLoginBundle:Default:signinV2.html.twig', array('errormsg' => 'You need Admin privillages to do this addition.'));
     }
 }