Skip to content

Commit

Permalink
Fixed a bug where uniqid would be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Mar 5, 2018
1 parent 223c231 commit 64c4352
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/MapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -499,6 +499,7 @@ private function _padParts (Map $model)
*
* @param ElementQuery $query
* @param array $value
* @param string $tableAlias
*
* @throws Exception
*/
Expand Down Expand Up @@ -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]]))
)
)
)";
Expand Down

0 comments on commit 64c4352

Please sign in to comment.