All pastes #441155 Raw Edit

Something

public php v1 · immutable
·published 2007-04-15 15:18 UTC
rendered paste body
$query = new Doctrine_RawSql();        //$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")    $query->select("{l.}*,  {GeoDistKM(l.lat, l.lon, 49.2370244, 14.6242759) AS distance}")                     ->from('location l, location_i18n i18n')                                 ->limit($limit)             // not current location             ->where('l.id != ? AND i18n.culture = ?', array($this->getId(), $culture))             ->having('distance < ?', $radius)             ->orderby('distance ASC');                 $query->addComponent('l', 'Location');