core icon indicating copy to clipboard operation
core copied to clipboard

Deprecation in QueryParameterValidateListener

Open dannyvw opened this issue 1 year ago • 2 comments

API Platform version(s) affected: 3.4

Description
User Deprecated: Since api-platform/core 3.3: Use a "ApiPlatform\State\ProviderInterface" as first argument in "ApiPlatform\Symfony\EventListener\QueryParameterValidateListener" instead of "ApiPlatform\ParameterValidator\ParameterValidator".

How to reproduce

Possible Solution

Additional Context

How can we solve this deprecation?

dannyvw avatar Oct 01 '24 12:10 dannyvw

I wish to know too 😁

james2001 avatar Oct 04 '24 10:10 james2001

+1

mv-developer avatar Oct 07 '24 19:10 mv-developer

@dannyvw @james2001 @dannyvw

This helped me: Upgrade Guide

Special guest:

php bin/console api:upgrade-resource

From the topic The Upgrade Command

derskythe avatar Oct 26 '24 00:10 derskythe

https://github.com/api-platform/core/pull/6655

soyuka avatar Oct 26 '24 07:10 soyuka

I managed to "solve it" by decorating the event listener QueryParameterValidateListener ... This is the snippet in my services.yaml file:

services:
    ApiPlatform\Symfony\EventListener\QueryParameterValidateListener:
        decorates: 'api_platform.listener.view.validate_query_parameters'
        arguments:
            $queryParameterValidator: '@App\State\SimpleStateProvider'

App\State\SimpleStateProvider is a dummy class with this content:

class SimpleStateProvider implements ProviderInterface
{

    public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
    {
        return [];
    }
}

I mean, it's more like a workaround than a solution.

sengaigibon avatar Oct 30 '24 11:10 sengaigibon

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 29 '24 11:12 stale[bot]

I encountered this issue too. The workaround https://github.com/api-platform/core/issues/6686#issuecomment-2446719406 works well, but still, i'm curious about the real solution here.

milanobrtlik avatar Jan 03 '25 10:01 milanobrtlik