I am writing a store locator, but I am having trouble with the HAVING clause. I am spitting out the query, and I keep getting a query without the HAVING clause. Am I missing something?
Here is my code:
$query = $this->modelsManager->createBuilder()
->from('Stores')
->columns(array('name',
'address',
'(
3959 * acos(
cos(
radians('.$area->latitude.')
) * cos(
radians( Stores.latitude )
) * cos(
radians( Stores.longitude ) - radians('.$area->longitude.')
) + sin(
radians('.$area->latitude.')
) * sin(
radians( latitude )
)
)
) AS distance'))
->orderby('distance DESC')
->having('distance < 1')
->getQuery()->execute();