In a Symfony2 project, I am using a custom Doctrine type 'unixtime' to map date fields stored as unix timestamps in a legacy database:
/**
* @var \DateTime
* @ORM\Column(name="created", type="unixtime", nullable=false)
*/
private $created;
Now I'd like to use DoctrineExtensions and stof/doctrine-extensions-bundle
to set this property automatically by adding:
* @Gedmo\Timestampable(on="create")
But this results in an exception, because "unixtime" is not among the $validTypes
in Gedmo\Timestampable\Mapping\Driver\Annotation
:
Field - [created] type is not valid and must be 'date', 'datetime' or 'time' in class ...
When I add 'unixtime' directly to that array of valid types, everything works fine.
What would be the best and least intrusive way to make the Timestampable handler work with my custom type? Is there a way to configure this? Do I need to subclass?