Ejemplo n.º 1
0
 /**
  * @param ImportedCountry $source
  * @param Country $destination
  * @return mixed
  */
 public function map($source, $destination)
 {
     $destination->setReservitId($source->getReservitId());
     $translations = array('fr' => $source->getFr(), 'en' => $source->getEn(), 'de' => $source->getDe(), 'es' => $source->getEs(), 'it' => $source->getIt(), 'nl' => $source->getNl());
     $this->translateProperty($destination, 'name', $translations);
     return $destination;
 }
Ejemplo n.º 2
0
 /**
  * @param Country $country
  * @param null $lang
  * @param bool $absolute
  * @return bool
  */
 public function generateCountryUrl(Country $country, $lang = null, $absolute = false)
 {
     if ($lang === null) {
         $lang = $this->context->get('language');
     }
     $slug = $country->getSlug();
     if ($slug && $lang) {
         return $this->router->generate('destination_sheet_country', array('slugCountry' => $slug, 'locale' => $lang), $absolute);
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * @param Country $country
  * @return Region
  */
 public function setCountry($country)
 {
     $this->country = $country;
     $country->addRegion($this);
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * @param Region $region
  * @param Country $country
  */
 protected function removeRegion($region, $country)
 {
     $countryId = $country->getId();
     if (!isset($this->removeRegions[$countryId])) {
         $this->removeRegions[$countryId] = array();
     }
     $this->removeRegions[$countryId][] = $region->getId();
 }
Ejemplo n.º 5
0
 /**
  * @param Country $country
  *
  * @return $this
  */
 public function removeCountry($country)
 {
     $this->countryType->deleteById($country->getId());
 }
Ejemplo n.º 6
0
 /**
  * Removes a country.
  *
  * @param Country $country
  * @return $this For fluid purposes.
  */
 public function removeCountry(\Seh\Bundle\SehBundle\Entity\Country $country)
 {
     $this->countries->removeElement($country);
     return $this;
 }
Ejemplo n.º 7
0
 /**
  * @param Country $country
  * @return array
  */
 public function findNbForCountryAndBrand($country, $brandId = null)
 {
     $countryId = $country;
     if ($country instanceof Country) {
         $countryId = $country->getId();
     }
     $qb = $this->getValidQueryBuilder()->andWhere('c.id = :country')->setParameter(':country', $countryId)->select('COUNT(DISTINCT h.id) as nbHotels');
     if ($brandId != null) {
         $qb->andWhere('b.id = :idBrand')->setParameter(':idBrand', $brandId);
     }
     return $qb->getQuery()->getSingleScalarResult();
 }