Skip to content

Instantly share code, notes, and snippets.

@sobstel
Created December 13, 2010 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sobstel/8c0c01597b5260f896ef to your computer and use it in GitHub Desktop.
Save sobstel/8c0c01597b5260f896ef to your computer and use it in GitHub Desktop.
Doctrine2 EnumType
<?php
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* My custom datatype.
*/
class EnumType extends Type
{
const ENUM = 'enum';
public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
// not relevant for this example
}
public function getName()
{
return self::ENUM;
}
}
Type::addType('enum', 'EnumType');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment