Example #1
0
 /**
  * @param ImportedDepartment $source
  * @param Department $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;
 }
Example #2
0
 /**
  * @param Department $department
  * @param null $lang
  * @param bool $absolute
  * @return bool
  */
 public function generateDepartmentUrl(Department $department, $lang = null, $absolute = false)
 {
     if ($lang === null) {
         $lang = $this->context->get('language');
     }
     $slug = $department->getSlug();
     if ($slug && $lang) {
         return $this->router->generate('destination_sheet_department', array('slugDepartment' => $slug, 'locale' => $lang), $absolute);
     }
     return false;
 }
Example #3
0
 /**
  * @param City $city
  * @param Department $department
  */
 protected function removeCity($city, $department)
 {
     $departmentId = $department->getId();
     if (!isset($this->removeCities[$departmentId])) {
         $this->removeCities[$departmentId] = array();
     }
     $this->removeCities[$departmentId][] = $city->getId();
 }
Example #4
0
 /**
  * @param Department $department
  *
  * @return $this
  */
 public function removeDepartment($department)
 {
     $this->departmentType->deleteById($department->getId());
 }
Example #5
0
 /**
  * @param Department $department
  * @return array
  */
 public function findNbForDepartmentAndBrand($department, $brandId = null)
 {
     $departmentId = $department;
     if ($department instanceof Department) {
         $departmentId = $department->getId();
     }
     $qb = $this->getValidQueryBuilder()->leftJoin('ci.department', 'd')->andWhere('d.id = :department')->setParameter(':department', $departmentId)->select('COUNT(DISTINCT h.id) as nbHotels');
     if ($brandId != null) {
         $qb->andWhere('b.id = :idBrand')->setParameter(':idBrand', $brandId);
     }
     return $qb->getQuery()->getSingleScalarResult();
 }