Receive Undefined class constant 'Doctrine\DBAL\Types\Type::DATE' when use filter

666 Views Asked by At

I'm using API platform v2.5 with Symfony 5.4 and php7.4. I'm tried to create filters with official documentation: https://api-platform.com/docs/v2.5/core/filters/ , but when I try to use filter on datetime property, the error occur.

Here is my filter definition:

* @ApiFilter(DateFilter::class, properties={"valid_to": "include_null_before"})

here valid_to is property in my entity. I tried to omit properties, but it doesn't have any effect.

I also tried to setup this filter in yaml configuration

//config/services.yaml
...
myentity.date_filter:
    parent: 'api_platform.doctrine.orm.date_filter'
    arguments: [ { valid_to: "include_null_before"} ]
    tags: [ 'api_platform.filter' ]

I'm expecting, that the filter works.

0

There are 0 best solutions below