/** * @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; }
/** * @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; }
/** * @param Country $country * @return Region */ public function setCountry($country) { $this->country = $country; $country->addRegion($this); return $this; }
/** * @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(); }
/** * @param Country $country * * @return $this */ public function removeCountry($country) { $this->countryType->deleteById($country->getId()); }
/** * 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; }
/** * @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(); }