Symfony2 Doctrine custom types generating unneeded migrations Symfony2 Doctrine custom types generating unneeded migrations symfony symfony

Symfony2 Doctrine custom types generating unneeded migrations


Here is a response from Steve Müller from this bug report : http://www.doctrine-project.org/jira/browse/DBAL-1085

I think you will have to mark your custom type as requiring a SQL comment, otherwise the schema manager cannot distinguish between DateTime type and your custom type because both map to the same native SQL type.

See here: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Types/Type.php#L327-L340

You will have to add the following to your custom type implementation:

/** * {@inheritdoc} */public function requiresSQLCommentHint(AbstractPlatform $platform){    return true;}

Also I think it might be required to give your custom type a distinct name like:

/** * {@inheritdoc} */public function getName(){    return 'datetime_utc';}

There features are implemented in doctrine >=2.3