pomm-project / api-platform

pomm 的 Api 平台桥接器

dev-master 2018-09-11 14:18 UTC

This package is auto-updated.

Last update: 2024-09-07 18:16:07 UTC


README

Build Status

使用 PommApi 平台 一起。

过滤器

搜索过滤器

搜索过滤器支持

  • partial 策略使用 LIKE %text% 搜索包含文本的字段。
  • start strategy 使用 LIKE text% 搜索以文本开头的字段。
  • end strategy 使用 LIKE %text 搜索以文本结尾的字段。
  • word_start 策略使用 LIKE text% OR LIKE % text% 搜索包含以文本开头的单词的字段。

如果你想让它不区分大小写,请在过滤器前加字母 i。例如 ipartialiexact

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']