public function supplementAction(Saison $saison) { $em = $this->getDoctrine()->getManager(); $session = $this->getRequest()->getSession(); if ($saison->getSaisonSupp() == NULL) { $saisonSupp = new SaisonSupp(); } else { $saisonSupp = $saison->getSaisonSupp(); } $form = $this->createForm(new SaisonSuppType(), $saisonSupp); $request = $this->getRequest(); if ($request->isMethod('POST')) { $form->submit($request); if ($form->isValid()) { $saisonSupp = $form->getData(); $em->persist($saisonSupp); $em->persist($saison->setSaisonSupp($saisonSupp)); $em->flush(); $session->getFlashBag()->add('success', " Votre saison de base a été modifié avec succées "); return $this->redirect($this->generateUrl("SupplementSaison", array('id' => $saison->getId()))); } } return $this->render("BackHotelTunisieBundle:Saisons:supplement.html.twig", array('hotel' => $saison->getHotel(), 'saison' => $saison, 'form' => $form->createView())); }