Instantly share code, notes, and snippets.

Embed
What would you like to do?
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