Created
April 26, 2012 03:18
-
-
Save khepin/2495430 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace Powwow\NewdbBundle\Types; | |
use Doctrine\DBAL\Types\Type; | |
use Doctrine\DBAL\Platforms\AbstractPlatform; | |
/** | |
* My custom datatype. | |
*/ | |
class GeoType extends Type | |
{ | |
const GEOTYPE = 'geotype'; // modify to match your type name | |
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) | |
{ | |
return null; | |
} | |
public function convertToPHPValue($value, AbstractPlatform $platform) | |
{ | |
return null; | |
} | |
public function convertToDatabaseValue($value, AbstractPlatform $platform) | |
{ | |
$dbval = 'SRID=4326;POINT(%s)'; | |
$value = sprintf($dbval, $value); | |
return $value; | |
} | |
public function getName() | |
{ | |
return self::GEOTYPE; // modify to match your constant name | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment