2012-06-14 4 views
7

맞춤 저장소 클래스에서 거리를 계산하고 싶습니다.Doctrine Query Builder ACOS 함수를 찾을 수 없습니다.

public function findLocation($latitude, $longitude) 
{ 
    $em = $this->getEntityManager(); 
    return $em->createQueryBuilder() 
        ->select('((ACOS(SIN('.$latitude.' * PI()/180) * SIN(p.latitude * PI()/180) + COS('.$latitude.' * PI()/180) * COS(p.latitude * PI()/180) * COS(('.$longitude.' – p.longitude) * PI()/180)) * 180/PI()) * 60 * 1.1515) AS distance') 
        ->from('StrictPlaceBundle:Poi', 'p') 
        ->add('orderBy', 's.distance ASC') 
        ->getQuery()->getResult();  
} 

것은 무엇 잘못 될 수 있습니다

다음
[Syntax Error] line 0, col 70: Error: Expected known function, got 'ACOS' 

쿼리입니다 : 문제는 교리가 ACOS 함수를 처리하는 동안 예외가 발생한다는 것입니다?

답변

관련 문제