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]])) ) ) )";