微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ApiPlatform - 自定义操作上的 GroupFilter

如何解决ApiPlatform - 自定义操作上的 GroupFilter

我想要一个这样的网址:

http://localhost/apI/Orders/test?name[]=test&name[]=toto

如果我有这个

@ApiFilter(GroupFilter::class,arguments={"parameterName": "name","overrideDefaultGroups": true})

所有路由都可以应用此过滤器,但我只想在自定义操作上应用过滤器。 有可能吗?

在我的代码中,我尝试了这个:

* @ApiResource(
 *     collectionoperations={
 *          "get"={},*          "indexByMarketplace"={
 *              "method"="get",*              "path"="/orders/test",*              "controller"=TestController::class,*              "defaults"={"_api_receive"=false},*              "openapi_context"={"parameters"={
 *                  {"in"="query","name"="externalIds[]","schema"={"type"="array","items"={"type": "string"}}}
 *              }},*              "pagination_enabled"=false
 *          }
 *     },

如果我这样做,网址如下所示: http://localhost/apI/Orders/test?name[]=toto,test

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。