7
我想在自定義存儲庫類中計算距離。問題是,學說拋出異常,在處理ACOS功能:原則查詢生成器無法找到ACOS功能
[Syntax Error] line 0, col 70: Error: Expected known function, got '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();
}
什麼可能是錯誤的?