예제 #1
0
 /**
  * @return string
  */
 public function getRankingKey()
 {
     return $this->geoname->getId() . '-' . $this->cuisine->getId();
 }
 /**
  * @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;
 }