Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Acme\TestBundle\Types;
- use Doctrine\DBAL\Types\Type;
- use Doctrine\DBAL\Platforms\AbstractPlatform;
- /**
- * My custom datatype.
- */
- class EnumType extends Type
- {
- const ENUM = 'enum'; // modify to match your type name
- public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
- {
- return 'enum';
- }
- public function convertToPHPValue($value, AbstractPlatform $platform)
- {
- return new Enum($value);
- }
- public function convertToDatabaseValue($value, AbstractPlatform $platform)
- {
- return $value->toString();
- }
- public function getName()
- {
- return self::ENUM;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement