예제 #1
0
 public function fraisChambreAction(Saison $saison, SaisonFraisChambre $chambre)
 {
     $em = $this->getDoctrine()->getManager();
     $session = $this->getRequest()->getSession();
     $form = $this->createForm(new SaisonFraisChambreType(), $chambre);
     $reqest = $this->getRequest();
     if ($reqest->isMethod('POST')) {
         $form->submit($reqest);
         if ($form->isValid()) {
             $chambre = $form->getData();
             $em->persist($chambre);
             $em->flush();
             $session->getFlashBag()->add('success', "le frais de la chambre " . $chambre->getChambre()->getLibelle() . " a été ajoutée avec succées.");
             return $this->redirect($this->generateUrl('saison_frais_autre_chambre', array('id' => $saison->getId(), 'chambre' => $chambre->getId())));
         }
     }
     $occChambre = $em->getRepository('BackHotelTunisieBundle:SaisonChambre')->findOneBy(array('saison' => $saison, 'chambre' => $chambre->getChambre()));
     if (is_null($occChambre)) {
         return $this->redirect($this->generateUrl('saison_delete_frais_autre_chambre', array('id' => $chambre->getId())));
     }
     return $this->render('BackHotelTunisieBundle:Saisons:frais_autres_chambres.html.twig', array('maxAdultes' => $occChambre->getMaxAdulte(), 'hotel' => $saison->getHotel(), 'saison' => $saison, 'form' => $form->createView(), 'chambre' => $chambre));
 }