rendered paste bodypublic function getNeighbours($limit = 10, $radius = 10, $culture = null)
{
if($culture === null)
{
$culture = sfContext::getInstance()->getUser()->getCulture();
}
$lat = $this->getLat();
$lon = $this->getLon();
$query = new Doctrine_Query();
$locations = $query->select("l.*, (((ACOS(SIN(($lat*PI()/180)) * SIN((l.lat*pi()/180)) + COS(($lat*PI()/180)) * COS((l.lat*PI()/180)) * COS((($lon - l.lon)*PI()/180))))*180/PI())*60*1.1515) distance")
->from('Location l , Location.LocationI18n i18n')
->limit($limit)
// not current location
->where('l.id != ? AND i18n.culture = ?', array($this->getId(), $culture))
->having('distance < ?', $radius)
->execute();
return $locations;
}