api-platform
api-platform copied to clipboard
`DateFilter` does not work with custom Doctrine ORM date types
API Platform version(s) affected: 2.7.11
Description
I have a custom Doctrine ORM type for my date fields. Nothing special, only changes the format of the date string to be written to the database to add microtime.
The trouble is, DateFilter
does not work with it, because it checks if the field type is in the list of hardcoded Doctrine types specified via ApiPlatform\Doctrine\Orm\Filter\DateFilter::DOCTRINE_DATE_TYPES
.
Since the DateFilter
class is final and all of it's methods are protected, I have no effective way of injecting my own Doctrine type into DateFilter
, either by extending or decorating the filter class. The only way is to copy and paste the entire implementation which is not ideal.
I would like to see DateFilter
improved to somehow allow flagging my own Doctrine type as safe to use by the filter.
Thanks!
Hi,
I'm upgrading an old project from API Platform 2.6 to 3.1 and now I'm hitting this issue as well.
I had a custom filter that extends from DateFilter but now that class is final so I can't use it any more.
Can we just have the DateFilter not be final, please?
Thanks
Same issue
@same issue here!