/** * TODO: is this used or is this deprecated already? * * @return \Symfony\Component\HttpFoundation\Response */ public function indexAction() { $form = $this->createForm(new InquiryType()); if ($this->getRequest()->isMethod('POST')) { $form->bindRequest($this->getRequest()); if ($form->isValid()) { //create inquire $inquire = new Inquiry(); $inquire->setFirstName($form->get('firstName')->getData()); $inquire->setLastName($form->get('lastName')->getData()); $inquire->setEmail($form->get('email')->getData()); $inquire->setInquirySubject($form->get('inquiry_subject')->getData()); $inquire->setMessage($form->get('message')->getData()); $inquire->setStatus(SiteUser::STATUS_ACTIVE); $inquire = $this->get('services.inquire')->createInquiry($inquire); if (count($inquire) > 0) { $this->get('session')->setFlash('notice', "Successfully submitted."); } else { $this->get('session')->setFlash('notice', "Unable to send inqueries!"); } } else { } } return $this->render('FrontendBundle:Inquiry:index.html.twig', array('form' => $form->createView())); }
public function testCreateInquiry() { //get data for inquiry subject $inquirySubject = $this->doctrine->getRepository('AdminBundle:InquirySubject')->find(1); $inquire = new Inquiry(); $inquire->setFirstName('test name'); $inquire->setLastName('test lastname'); $inquire->setEmail('*****@*****.**'); $inquire->setInquirySubject($inquirySubject); $inquire->setMessage('this is test'); $inquire->setStatus(SiteUser::STATUS_ACTIVE); $result = $this->service->createInquiry($inquire); $this->assertNotEmpty($result); }