I want to convert this query to cakephp
SELECT l.* , (
(
(
ACOS( SIN( (
$lat * PI( ) /180 ) ) * SIN( (
l.lat * PI( ) /180 )
) + COS( (
$lat * PI( ) /180 )
) * COS( (
l.lat * PI( ) /180 )
) * COS( (
( $lng - l.long ) * PI( ) /180 )
)
)
) *180 / PI( )
) *60 * 1.1515 * 1.609344
) AS `distance`
FROM hosts l
HAVING `distance` <= 50
ORDER BY `distance` ASC
Help me please ..... It would be more helpfull if I can add that in contiions array like
$this->paginate = array('conditions' => $conditions ,
'order' => array('Host.distance' => 'ASC')
);