/**
  * @return string
  */
 public function getRankingKey()
 {
     return $this->geoname->getId() . '-' . $this->cuisine->getId();
 }
 /**
  * @param Geoname $geoname
  * @return float
  */
 public function getRandomLng(Geoname $geoname)
 {
     $lng = floatval($geoname->getLng());
     return $lng + $this->getRandomOffset();
 }
 protected function importCity(Geoname $geoname)
 {
     $previewGeoname = $this->input->getOption('previewGeoname');
     if ($previewGeoname) {
         return;
     }
     if ($geoname->getCountry() === 'US') {
         $cityName = $geoname->getAsciiName() . ', ' . $geoname->getAdmin1();
     } else {
         $cityName = $geoname->getAsciiName() . ',' . $geoname->getCountry();
     }
     $maxPages = $this->input->getOption('pages');
     $currentPage = 0;
     while ($currentPage < $maxPages) {
         $venues = $this->foursquareClient->explore($cityName, $currentPage * 50);
         $this->processResults($venues, $geoname);
         $currentPage++;
     }
 }
 /**
  * @param Geoname $geoname
  *
  * @throws \Doctrine\DBAL\DBALException
  * @return boolean
  */
 public function checkIfUsed(Geoname $geoname)
 {
     $id = $geoname->getId();
     $sql = 'SELECT(
         (SELECT COUNT(reviews.geoname_id) FROM reviews WHERE geoname_id = ' . $id . ') +
         (SELECT COUNT(users.geoname_id) FROM users WHERE geoname_id = ' . $id . ') +
         (SELECT COUNT(wishes.geoname_id) FROM wishes WHERE geoname_id = ' . $id . '6) +
         (SELECT COUNT(restaurants.geoname_id) FROM restaurants WHERE geoname_id = ' . $id . ')
         ) as geonameCount';
     $result = $this->getEntityManager()->getConnection()->fetchAll($sql);
     return $result[0]['geonameCount'] > 0;
 }