Exemplo n.º 1
0
 /**
  * Create Altinv Track Fields entities via ajax.
  *
  * @Route("/fieldtrackadd", name="ajax_fieldstrackaltinv_create")
  * @Method("POST")
  */
 public function ajaxCreateFieldsTrackAltinv(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     //primero creo elcampo en fields altinv trackable true
     $object = new FieldsAltinv();
     $object->setDescription($request->get('description'));
     $object->setWidget('Currency');
     $object->setTrackable(true);
     $em->persist($object);
     $em->flush();
     $id_field = $em->getReference('BL\\SGIBundle\\Entity\\FieldsAltinv', intval($object->getId()));
     $id_altinv = $em->getReference('BL\\SGIBundle\\Entity\\Altinv', $request->get('id_altinv'));
     $object = new BlAltinv();
     $object->setIdField($id_field);
     $object->setIdAltinv($id_altinv);
     $em->persist($object);
     $em->flush();
     return new JsonResponse($id_field);
 }
Exemplo n.º 2
0
 /**
  * Creates a form to delete a FieldsAltinv entity.
  *
  * @param FieldsAltinv $fieldsAltinv The FieldsAltinv entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(FieldsAltinv $fieldsAltinv)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('fieldsaltinv_delete', array('id' => $fieldsAltinv->getId())))->setMethod('DELETE')->getForm();
 }