/** * @Route("/retrieve-client-consulta", name="profesional_retrieve_chunk_user") * @Template() */ public function chunkInfoUserConsultaAction() { if ($this->getRequest()->getMethod() != 'POST') { throw new \Exception('Hack attemp :('); } $me = $this->get('security.context')->getToken()->getUser(); $em = $this->getDoctrine()->getManager(); $id = $this->getRequest()->get('idUser'); $user = $em->getRepository('CoreUserBundle:User')->find($id); $report = new Report(); $report->setCreatedAt(new \DateTime()); $report->setClient($user->getClient()); $report->setProfessional($me->getProfessional()); $form = $this->createForm(new ReportType(), $report); return array('entity' => $user->getClient(), 'form' => $form->createView()); }