/** * Create Rental Type entities. * * @Route("/add", name="ajax_typerental_create") * @Method("POST") */ public function ajaxCreateRental(Request $request) { $em = $this->getDoctrine()->getManager(); $object = new TypeRental(); $object->setDescription($request->get('description')); $em->persist($object); $em->flush(); return new JsonResponse($object->getId()); }
/** * Creates a form to delete a TypeRental entity. * * @param TypeRental $typeRental The TypeRental entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(TypeRental $typeRental) { return $this->createFormBuilder()->setAction($this->generateUrl('typerental_delete', array('id' => $typeRental->getId())))->setMethod('DELETE')->getForm(); }