doctrine/dbal — pull request #661 by yannickl88 (2014-08-15 14:35:01+00:00)
Title: Added field specific options for converting data between PHP and DB

Added option parameter so field specific data can be passed when converting data for types. This is needed in cases like enum types or more generic types where you want field specific options for conversion.

This would give developers more freedom in creating custom domain-specific types.

Our (simplified) use-case is:
```php
class EnumType extends Type
{
const ENUM = 'enum';

public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return 'Enum';
}

public function convertToPHPValue($value, AbstractPlatform $platform, array $options = [])
{
return (null === $value) ? null : new $options['class']((int) $value);
}

public function convertToDatabaseValue($value, AbstractPlatform $platform, array $options = [])
{
return $value;
}

public function getName()
{
return self::ENUM;
}
}
```
This way you can define a generic Enum and configure the matching type of the enum in the field itself. The end goal is to make use of this change in the ORM as follows:
```php
class Entity
{
/**
* @ORM\Column(
* name = "bar",
* type = "enum",
* type_options = {
* "class" = "\Foo\Bar\FooBarEnum"
* }
* )
* @var FooBarEnum
*/
private $foo;
}
```