Esempio n. 1
0
 /**
  * @Route("/new", name="ui_company_new")
  * @Template()
  * @Method("POST")
  * @Security("has_role('ROLE_USER')")
  */
 public function newAction()
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->getUser();
     $request = $this->getRequest();
     $name = $request->get('name');
     $voicemail = new VoiceMail();
     $voicemail->setFullname($name);
     $voicemail->setEmail($user->getEmail());
     $em->persist($voicemail);
     $company = new Company();
     $company->setName($name);
     $company->setVoicemail($voicemail);
     $em->persist($company);
     $user->setCompany($company);
     $em->flush();
     $this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!');
     return $this->redirect($this->generateUrl('ui_company'));
 }
Esempio n. 2
0
 public function voicemailToVoicemail($voicemail)
 {
     if (!($vm = $voicemail->getAstVoicemail())) {
         $vm = new VoiceMail();
     }
     $vm->setMailbox($voicemail->getHash());
     $vm->setContext('mailbox');
     $vm->setPassword(rand(1000, 9999));
     $vm->setFullname($voicemail->getSubscription()->getCompany()->getName());
     $vm->setEmail('*****@*****.**');
     return $vm;
 }