On Fri, Nov 6, 2009 at 3:33 PM, Jonathan Wage <jonw
...@gmail.com> wrote:
> Here are some examples:
> namespace \Doctrine\DBAL\Types;
> class MyCustomObjectType extends Type
> {
> public function getName()
> {
> return 'MyCustomObjectType';
> }
> public function getSqlDeclaration(array $fieldDeclaration,
> \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
> {
> return $platform->getClobDeclarationSql($fieldDeclaration);
> }
> public function convertToDatabaseValue($value,
> \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
> {
> return serialize($value);
> }
> public function convertToPHPValue($value)
> {
> return unserialize($value);
> }
> }
> Type::addCustomType(
> 'MyCustomObjectType',
> 'Doctrine\DBAL\Types\MyCustomObjectType'
> );
> class MyString extends StringType
> {
> }
> Type::overrideType('string', 'Doctrine\DBAL\Types\MyString');
> On Fri, Nov 6, 2009 at 9:22 AM, Nico Kaiser <n...@kaiser.me> wrote:
>> Hi!
>> What is the best way to add custom Types to DDC? There is for example
>> DC's ENUM type (which is currently missing in DDC, see DDC-65 [1]) - as
>> ENUM may be DBMS specific, what is the best way to implement it?
>> Can I do it as plugin/extension, or do I have to patch DDC?
>> Nico
>> [1] http://www.doctrine-project.org/jira/browse/DDC-65
> --
> Jonathan H. Wage (+1 415 992 5468)
> Open Source Software Developer & Evangelist
> sensiolabs.com | jwage.com | doctrine-project.org | symfony-project.org
> You should follow me on Twitter: http://www.twitter.com/jwage
> You can contact Jonathan about Doctrine, Symfony and Open-Source or for
> training, consulting, application development, or business related questions
> at jonathan.w...@sensio.com
--