api-platform / api-platform/core

`DateFilter` does not work with custom Doctrine ORM date types

未關閉
#8,074 4 則留言 7 個 reaction 已指派 0 人 在 GitHub 檢視
doctrine
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 5 小時
30 天內合併 PR
48

描述

**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!

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。