/**
  * @Route("/job/new", name="job_new", options={"expose": true})
  */
 public function searchJobAction(Request $request)
 {
     $queryJob = new QueryJob();
     $queryJob->setStartDate(new \DateTime('now'));
     $queryJob->setEndDate(new \DateTime('now'));
     $user = $this->get('security.context')->getToken()->getUser()->getUser();
     $form = $this->createJobForm($queryJob);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $queryJob->setUser($user);
         $query = new Query();
         $query->setQueryJob($queryJob);
         $query->setUser($user);
         $query->setDate(new \DateTime('now'));
         $query->setText($form["text"]->getData());
         $query->setLat($form["lat"]->getData());
         $query->setLng($form["lng"]->getData());
         $query->setRadius($form["radius"]->getData());
         $this->callRequest($query);
         $em->persist($queryJob);
         $em->flush();
         return $this->redirect($this->generateUrl('info_query', array('id' => $query->getId())));
     }
     return $this->render('AppBundle:User:search-jobs.html.twig', array('form' => $form->createView()));
 }
 public function queryNew(QueryJob $qj, Query $q)
 {
     $query = new Query();
     $user = $qj->getUser();
     $em = $this->getDoctrine()->getManager();
     $query->setUser($user);
     $query->setQueryJob($qj);
     $query->setDate(new \DateTime('now'));
     $query->setText($q->getText());
     $query->setLat($q->getLat());
     $query->setLng($q->getLng());
     $query->setRadius($q->getRadius());
     $this->callRequest($query);
     $em->persist($query);
     $em->flush();
 }