diff --git a/composer.json b/composer.json index b5b179de..5f38a78c 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "creof/doctrine2-spatial", + "name": "philkingston/doctrine2-spatial", "type": "library", "description": "Doctrine2 multi-platform support for spatial types and functions", "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], diff --git a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php index 4444fca4..7cf3ea2e 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php @@ -58,7 +58,7 @@ public function getSQLDeclaration(array $fieldDeclaration) */ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) { - return sprintf('AsBinary(%s)', $sqlExpr); + return sprintf('ST_AsBinary(%s)', $sqlExpr); } /** @@ -69,6 +69,6 @@ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) */ public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) { - return sprintf('GeomFromText(%s)', $sqlExpr); + return sprintf('ST_GeomFromText(%s)', $sqlExpr); } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php index 2c1943d8..589f5f74 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php @@ -36,7 +36,7 @@ class AsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInte { protected $platforms = array('mysql'); - protected $functionName = 'AsBinary'; + protected $functionName = 'ST_AsBinary'; protected $minGeomExpr = 1; diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php index 3eeb336c..ba7ffc14 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php @@ -35,7 +35,7 @@ class GeomFromText extends AbstractSpatialDQLFunction { protected $platforms = array('mysql'); - protected $functionName = 'GeomFromText'; + protected $functionName = 'ST_GeomFromText'; protected $minGeomExpr = 1; diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistanceSphere.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistanceSphere.php new file mode 100644 index 00000000..fd0dd4b1 --- /dev/null +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistanceSphere.php @@ -0,0 +1,40 @@ + + * @license https://philkingston.mit-license.org MIT + */ +class STDistanceSphere extends AbstractSpatialDQLFunction +{ + protected $platforms = array('mysql'); + protected $functionName = 'ST_Distance_Sphere'; + protected $minGeomExpr = 2; + protected $maxGeomExpr = 2; +}