Beispiel #1
0
 /**
  * Remove Comtrad Fields entities from form via ajax.
  *
  * @Route("/remo", name="ajax_fieldscomtrad_remove")
  * @Method("POST")
  */
 public function ajaxRemoveFieldsComtrad(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $object = new FieldsComtrad();
     $object->setDescription($request->get('description'));
     $object->setWiget($request->get('widget'));
     $object->setTrackable($request->get('trackable'));
     $em->persist($object);
     $em->flush();
     return new JsonResponse($object->getId());
 }
Beispiel #2
0
 /**
  * Create Comtrad Track Fields entities via ajax.
  *
  * @Route("/fieldtrackadd", name="ajax_fieldstrackcomtrad_create")
  * @Method("POST")
  */
 public function ajaxCreateFieldsTrackComtrad(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     //primero creo elcampo en fields comtrad trackable true
     $object = new FieldsComtrad();
     $object->setDescription($request->get('description'));
     $object->setWiget('Currency');
     $object->setTrackable(true);
     $em->persist($object);
     $em->flush();
     $id_field = $em->getReference('BL\\SGIBundle\\Entity\\FieldsComtrad', intval($object->getId()));
     $id_comtrad = $em->getReference('BL\\SGIBundle\\Entity\\Comtrad', $request->get('id_comtrad'));
     $object = new BlComtrad();
     $object->setIdField($id_field);
     $object->setIdComtrad($id_comtrad);
     $em->persist($object);
     $em->flush();
     return new JsonResponse($id_field);
 }