core
core copied to clipboard
Deprecation in QueryParameterValidateListener
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?
I wish to know too 😁
+1
@dannyvw @james2001 @dannyvw
This helped me: Upgrade Guide
Special guest:
php bin/console api:upgrade-resource
From the topic The Upgrade Command
https://github.com/api-platform/core/pull/6655
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.
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.
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.