forked from creof/doctrine2-spatial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request creof#127 from djlambert/dev
Rename AbstractGeometryType to AbstractSpatialType, refactor abstract methods
- Loading branch information
Showing
23 changed files
with
102 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
use CrEOF\Spatial\Exception\InvalidValueException; | ||
use CrEOF\Spatial\Exception\UnsupportedPlatformException; | ||
use CrEOF\Spatial\DBAL\Platform\PlatformInterface; | ||
use CrEOF\Spatial\PHP\Types\Geography\GeographyInterface; | ||
use CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface; | ||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Types\Type; | ||
|
@@ -36,22 +37,32 @@ | |
* @author Derek J. Lambert <[email protected]> | ||
* @license http://dlambert.mit-license.org MIT | ||
*/ | ||
abstract class AbstractGeometryType extends Type | ||
abstract class AbstractSpatialType extends Type | ||
{ | ||
const PLATFORM_MYSQL = 'MySql'; | ||
const PLATFORM_POSTGRESQL = 'PostgreSql'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
abstract public function getTypeFamily(); | ||
public function getTypeFamily() | ||
{ | ||
return $this instanceof GeographyType ? GeographyInterface::GEOGRAPHY : GeometryInterface::GEOMETRY; | ||
} | ||
|
||
/** | ||
* Gets the SQL name of this type. | ||
* | ||
* @return string | ||
*/ | ||
abstract public function getSQLType(); | ||
public function getSQLType() | ||
{ | ||
$class = get_class($this); | ||
$start = strrpos($class, '\\') + 1; | ||
$len = strlen($class) - $start - 4; | ||
|
||
return substr($class, strrpos($class, '\\') + 1, $len); | ||
} | ||
|
||
/** | ||
* @return bool | ||
|
@@ -138,7 +149,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) | |
*/ | ||
public function getName() | ||
{ | ||
return array_search(get_class($this), $this->getTypesMap()); | ||
return array_search(get_class($this), self::getTypesMap(), true); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.