Beispiel #1
0
 /**
  * @param ImportedRegion $source
  * @param Region $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;
 }
Beispiel #2
0
 /**
  * @param Region $region
  * @param null $lang
  * @param bool $absolute
  * @return bool
  */
 public function generateRegionUrl(Region $region, $lang = null, $absolute = false)
 {
     if ($lang === null) {
         $lang = $this->context->get('language');
     }
     $slug = $region->getSlug();
     if ($slug && $lang) {
         return $this->router->generate('destination_sheet_region', array('slugRegion' => $slug, 'locale' => $lang), $absolute);
     }
     return false;
 }
Beispiel #3
0
 /**
  * @param Department $department
  * @param Region $region
  */
 protected function removeDepartment($department, $region)
 {
     $regionId = $region->getId();
     if (!isset($this->removeDepartments[$regionId])) {
         $this->removeDepartments[$regionId] = array();
     }
     $this->removeDepartments[$regionId][] = $department->getId();
 }
Beispiel #4
0
 /**
  * @return Country
  */
 public function getCountry()
 {
     return $this->region->getCountry();
 }
Beispiel #5
0
 /**
  * @param Region $region
  *
  * @return $this
  */
 public function removeRegion($region)
 {
     $this->regionType->deleteById($region->getId());
 }
Beispiel #6
0
 /**
  * Removes a region.
  *
  * @param Region $region
  * @return $this For fluid purposes.
  */
 public function removeRegion(\Seh\Bundle\SehBundle\Entity\Region $region)
 {
     $this->regions->removeElement($region);
     return $this;
 }
Beispiel #7
0
 /**
  * @param Region $region
  * @return array
  */
 public function findNbForRegionAndBrand($region, $brandId = null)
 {
     $regionId = $region;
     if ($region instanceof Region) {
         $regionId = $region->getId();
     }
     $qb = $this->getValidQueryBuilder()->andWhere('r.id = :region')->setParameter(':region', $regionId)->select('COUNT(DISTINCT h.id) as nbHotels');
     if ($brandId != null) {
         $qb->andWhere('b.id = :idBrand')->setParameter(':idBrand', $brandId);
     }
     return $qb->getQuery()->getSingleScalarResult();
 }