From 64c4352eaa4e5caceced9f1b4ba96074be7c1822 Mon Sep 17 00:00:00 2001 From: Tam Date: Mon, 5 Mar 2018 11:53:22 +0000 Subject: [PATCH] Fixed a bug where `uniqid` would be undefined --- src/services/MapService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/MapService.php b/src/services/MapService.php index b46ede0..87523fc 100644 --- a/src/services/MapService.php +++ b/src/services/MapService.php @@ -257,7 +257,7 @@ public function modifyElementsQuery (ElementQueryInterface $query, $value) /** @var ElementQuery $query */ $tableName = MapRecord::$tableName; - $tableAlias = unqid('simplemap'); + $tableAlias = 'simplemap' . bin2hex(openssl_random_pseudo_bytes(5)); $on = [ 'and', @@ -499,6 +499,7 @@ private function _padParts (Map $model) * * @param ElementQuery $query * @param array $value + * @param string $tableAlias * * @throws Exception */ @@ -552,10 +553,10 @@ private function _searchLocation (ElementQuery $query, $value, $tableAlias) * DEGREES( ACOS( COS(RADIANS($location[lat])) - * COS(RADIANS([[simplemap.lat]])) + * COS(RADIANS([[$tableAlias.lat]])) * COS(RADIANS($location[lng]) - RADIANS([[$tableAlias.lng]])) + SIN(RADIANS($location[lat])) - * SIN(RADIANS([[simplemap.lat]])) + * SIN(RADIANS([[$tableAlias.lat]])) ) ) )";