api platform, can’t add a custom search filter to an abstract class using symfony 4

  api-platform.com, filter, symfony

I’m trying to create a custom search filter to an abstract class, i want to be able to search by one keyword .

The search filter code :

public function getDescription(string $resourceClass): array
        $reader = new AnnotationReader();
        $annotation = $reader->getClassAnnotation(new ReflectionClass(new $resourceClass), SearchAnnotation::class);

        $description['search'] = [
            'property' => 'search',
            'type' => 'string',
            'required' => false,
            'swagger' => ['description' => 'FullTextFilter on ' . implode(', ', $annotation->fields)],

        return $description;

The custom search try to get a new instance of the resource class but in my case it’s an abstract class and i got an error about :

Cannot instantiate abstract class.

Source: Symfony Questions