private function processForm(Meeting $meeting)
 {
     $created = $meeting && null === $meeting->getId();
     $statusCode = $created ? Response::HTTP_CREATED : Response::HTTP_NO_CONTENT;
     $method = $created ? "POST" : "PUT";
     $form = $this->createForm(new MeetingType(), $meeting, array('method' => $method));
     $form->handleRequest($this->getRequest());
     $view;
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $items = $meeting->getItems();
         foreach ($items as $item) {
             $item->setMeeting($meeting);
             $em->persist($item);
         }
         $em->persist($meeting);
         $em->flush();
         $view = $this->view()->setStatusCode($statusCode);
         // HTTP Convention : return HTTP 201 Created + Location of created resource
         if ($created) {
             $view->setLocation($this->generateUrl('get_meeting', ['id' => $meeting->getId()]));
         }
     } else {
         $view = $this->view($form, Response::HTTP_BAD_REQUEST);
     }
     return $this->handleView($view);
 }
 private function createMeeting()
 {
     $meeting = new Meeting();
     $meeting->setName($this->getTitle(true));
     $meeting->setDate($this->getDate());
     $meeting->setPlace($this->getLocation());
     return $meeting;
 }
 /**
  * Gets the list of all Items for a specific Meeting.
  */
 public function getItemsAction(Meeting $meeting)
 {
     $em = $this->getDoctrine()->getManager();
     // TODO : Add authorization based on meeting container
     $items = $meeting->getItems();
     $view = $this->view($items, Response::HTTP_OK);
     return $this->handleView($view);
 }
 /**
  * Generate a PDF for a given Meeting entity
  */
 public function exportToPDFAction(Meeting $meeting)
 {
     $html = $this->render("InterneSeanceBundle:Export:pdf_export.html.twig", ["meeting" => $meeting])->getContent();
     //return new Response($html);
     //*
     $html2pdf = $this->get('html2pdf_factory')->create();
     $html2pdf->WriteHTML($html);
     $html2pdf->pdf->SetTitle($meeting->getName());
     $file = $html2pdf->Output("export_" . strtolower($meeting->getName()) . ".pdf", "I");
     //*/
 }