pomm-project / api-platform
pomm 的 Api 平台桥接器
dev-master
2018-09-11 14:18 UTC
Requires
- php: >=7.0
- api-platform/core: ~2.0
- pomm-project/pomm-bundle: ~2.4
This package is auto-updated.
Last update: 2024-09-07 18:16:07 UTC
README
过滤器
搜索过滤器
搜索过滤器支持
partial
策略使用LIKE %text%
搜索包含文本的字段。start strategy
使用LIKE text%
搜索以文本开头的字段。end strategy
使用LIKE %text
搜索以文本结尾的字段。word_start
策略使用LIKE text% OR LIKE % text%
搜索包含以文本开头的单词的字段。
如果你想让它不区分大小写,请在过滤器前加字母 i
。例如 ipartial
或 iexact
。
在 services.yml
中添加条目
services: app.book.search_filter: parent: 'api_platform.pomm.search_filter' arguments: [ { 'title': 'exact', 'description': 'partial'} ] tags: [ { name: 'api_platform.filter', id: 'book.search' } ]
在 resources.yml
中使用服务过滤器
resources: AppBundle\Entity\Book: collectionOperations: get: filters: ['book.search']