I have added a custom type like:
namespace My\\SuperBundle\\Types;
use Doctrine\\DBAL\\Types\\Type;
use Doctrine\\DBAL\\Platforms\\AbstractPlatform;
class Mo
You have to override the method requiresSQLCommentHint(AbstractPlatform $platform)
and return true
. Like that, doctrine will remember the custom type.
namespace My\SuperBundle\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class Money extends Type
{
const MONEY = 'money';
public function getSqlDeclaration(
array $fieldDeclaration,
AbstractPlatform $platform
) {
return 'DECIMAL(10,2)';
}
public function getName()
{
return self::MONEY;
}
/**
* @inheritdoc
*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;
}
}
Source: Use column comments for further Doctrine Type Inference