places: refactor string interpolation
parent
5dffccbc91
commit
bc6366c65f
|
@ -202,19 +202,22 @@ class PlacesSetup extends Command
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
if (GIS_TYPE_MYSQL === $this->gisType) {
|
if (GIS_TYPE_MYSQL === $this->gisType) {
|
||||||
$points = array_map(function ($point) {
|
$points = implode(',', array_map(function (&$point) {
|
||||||
return $point[0].' '.$point[1];
|
$x = $point[0];
|
||||||
}, $coords);
|
$y = $point[1];
|
||||||
$geometry = implode(',', $points);
|
|
||||||
|
|
||||||
$geometry = 'POLYGON(('.$geometry.'))';
|
return "{$x} {$y}";
|
||||||
$geometry = 'ST_GeomFromText(\''.$geometry.'\')';
|
}, $coords));
|
||||||
|
|
||||||
|
$geometry = "ST_GeomFromText('POLYGON(({$points}))')";
|
||||||
} elseif (GIS_TYPE_POSTGRES === $this->gisType) {
|
} elseif (GIS_TYPE_POSTGRES === $this->gisType) {
|
||||||
$points = array_map(function ($point) {
|
$points = implode(',', array_map(function (&$point) {
|
||||||
return '('.$point[0].','.$point[1].')';
|
$x = $point[0];
|
||||||
}, $coords);
|
$y = $point[1];
|
||||||
$geometry = implode(',', $points);
|
|
||||||
$geometry = 'POLYGON(\''.$geometry.'\')';
|
return "({$x},{$y})";
|
||||||
|
}, $coords));
|
||||||
|
$geometry = "POLYGON('{$points}')";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue