Я хочу рассчитать расстояние в своем пользовательском классе репозитория. Проблема в том, что Doctrine выдает исключение при обработке функции 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();
}
Что может быть не так?