コード例 #1
0
 public function saveTourLanguage($tourIdiomaTO)
 {
     $em = $this->getEntityManager();
     $tourIdioma = $this->findTourByIdAndIdLanguage($tourIdiomaTO->getIdTour(), $tourIdiomaTO->getIdIdioma());
     $isNew = Generalkeys::BOOLEAN_FALSE;
     if (is_null($tourIdioma)) {
         $isNew = Generalkeys::BOOLEAN_TRUE;
         $tourIdioma = new Touridioma();
         $tourIdioma->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO));
         $tourIdioma->setTour($em->getReference('VisitaYucatanBundle:Tour', $tourIdiomaTO->getIdTour()));
         $tourIdioma->setIdioma($em->getReference('VisitaYucatanBundle:Idioma', $tourIdiomaTO->getIdIdioma()));
     }
     $tourIdioma->setNombretour($tourIdiomaTO->getNombretour());
     $tourIdioma->setCircuito($tourIdiomaTO->getCircuito());
     $tourIdioma->setDescripcion($tourIdiomaTO->getDescripcion());
     // Valida que slo adultos no sea null
     if (is_null($tourIdiomaTO->getSoloadultos()) || $tourIdiomaTO->getSoloadultos() == Generalkeys::BOOLEAN_FALSE) {
         $tourIdioma->setSoloadultos(Generalkeys::BOOLEAN_FALSE);
     } else {
         $tourIdioma->setSoloadultos(Generalkeys::BOOLEAN_TRUE);
     }
     $em->persist($tourIdioma);
     $em->flush();
     return $isNew;
 }
コード例 #2
0
 public function createTour($tourTO)
 {
     $em = $this->getEntityManager();
     // Crea el tour
     $tour = new Tour();
     $tour->setPromovido(Generalkeys::BOOLEAN_FALSE);
     $tour->setMinimopersonas($tourTO->getMinimopersonas());
     $tour->setDescripcion($tourTO->getDescripcion());
     $tour->setMapa($tourTO->getMapa());
     $tour->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO));
     $em->persist($tour);
     // Crea un registro de idioma tour con el idioma español
     $tourIdioma = new Touridioma();
     $tourIdioma->setNombretour($tourTO->getDescripcion());
     $tourIdioma->setCircuito($tourTO->getCircuito());
     $tourIdioma->setTour($tour);
     $tourIdioma->setIdioma($em->getReference('VisitaYucatanBundle:Idioma', Generalkeys::IDIOMA_ESPANOL));
     $tourIdioma->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO));
     $tourIdioma->setSoloadultos(Generalkeys::BOOLEAN_FALSE);
     $em->persist($tourIdioma);
     // Crea un origen de tour , con el origen merida
     $tourOrigen = new TourOrigen();
     $tourOrigen->setTarifaAdulto($tourTO->getTarifaadulto());
     $tourOrigen->setTarifaMenor($tourTO->getTarifamenor());
     $tourOrigen->setTour($tour);
     $tourOrigen->setOrigen($em->getReference('VisitaYucatanBundle:Origen', Generalkeys::ORIGEN_MERIDA));
     $tourOrigen->setEstatus($em->getReference('VisitaYucatanBundle:Estatus', Estatuskeys::ESTATUS_ACTIVO));
     $em->persist($tourOrigen);
     $em->flush();
 }