/** * Remove Constru Fields entities from form via ajax. * * @Route("/remo", name="ajax_fieldsconstru_remove") * @Method("POST") */ public function ajaxRemoveFieldsConstru(Request $request) { $em = $this->getDoctrine()->getManager(); $object = new FieldsConstru(); $object->setDescription($request->get('description')); $object->setWidget($request->get('widget')); $object->setTrackable($request->get('trackable')); $em->persist($object); $em->flush(); return new JsonResponse($object->getId()); }
/** * Create Constru Track Fields entities via ajax. * * @Route("/fieldtrackadd", name="ajax_fieldstrackconstru_create") * @Method("POST") */ public function ajaxCreateFieldsTrackConstru(Request $request) { $em = $this->getDoctrine()->getManager(); //primero creo elcampo en fields constru trackable true $object = new FieldsConstru(); $object->setDescription($request->get('description')); $object->setWidget('Currency'); $object->setTrackable(true); $em->persist($object); $em->flush(); $id_field = $em->getReference('BL\\SGIBundle\\Entity\\FieldsConstru', intval($object->getId())); $id_constru = $em->getReference('BL\\SGIBundle\\Entity\\Constru', $request->get('id_constru')); $object = new BlConstru(); $object->setIdField($id_field); $object->setIdConstru($id_constru); $em->persist($object); $em->flush(); return new JsonResponse($id_field); }