api-platform / api-platform/core

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

Aberta
#8,074 4 comentários 7 reações 0 responsáveis Ver no GitHub
doctrine
Linguagem predominante
PHP
Estrelas
2.6k
Forks
980
Merge médio
2d 5h
PRs com merge (30d)
48

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.