public function addLeaseRegistrationTypeAction(Request $request) { $session = $this->getRequest()->getSession(); if ($session->get('type') != 1) { //if user is login then it will be redirect to login page return $this->redirect($this->generateUrl('drp_adminLogin')); } $em = $this->getDoctrine()->getEntityManager(); if ($request->getMethod() == 'POST') { $code = $request->get('code'); $type = $request->get('type'); $description = $request->get('description'); $addRegistrationType = new RegistrationType(); $addRegistrationType->setType($type); $addRegistrationType->setDescription($description); $addRegistrationType->setCode($code); $addRegistrationType->setPropertyType('lease'); $em->persist($addRegistrationType); $em->flush(); return $this->redirect($this->generateUrl('drp_leaseRegistrationType')); } return $this->render('DRPAdminBundle:Pages:addLeaseRegistrationType.html.twig'); }
public function addLeaseRegistrationTypeAction(Request $request) { $em = $this->getDoctrine()->getEntityManager(); if ($request->getMethod() == 'POST') { $type = $request->get('type'); $description = $request->get('description'); $addRegistrationType = new RegistrationType(); $addRegistrationType->setType($type); $addRegistrationType->setDescription($description); $addRegistrationType->setPropertyType('lease'); $em->persist($addRegistrationType); $em->flush(); return $this->redirect($this->generateUrl('drp_leaseRegistrationType')); } return $this->render('DRPAdminBundle:Pages:addLeaseRegistrationType.html.twig'); }