小编Ayt*_*Nzt的帖子

Api 平台所需的过滤器

我使用 API 平台,我在https://api-platform.com/docs/core/filters/#creating-custom-filters 之后定义了一个自定义过滤器

它工作正常,但是每次该应用程序执行特定实体的 GET HTTP 请求(设置过滤器的位置)时我都需要该过滤器。

我检查了这个代码:

// This function is only used to hook in documentation generators (supported by Swagger and Hydra)
public function getDescription(string $resourceClass): array
{
    if (!$this->properties) {
        return [];
    }

    $description = [];
    foreach ($this->properties as $property => $strategy) {
        $description["similar_$property"] = [
            'property' => $property,
            'type' => 'string',
            'required' => false,
            'swagger' => [
                'description' => 'Filter using a similar postgres function.',
                'name' => $property,
                'type' => …
Run Code Online (Sandbox Code Playgroud)

symfony api-platform.com symfony-4.2

1
推荐指数
1
解决办法
3871
查看次数

标签 统计

api-platform.com ×1

symfony ×1

symfony-4.2 ×1