rebelcode / expression-wp-query-builder
使用表达式构建 WP_Query 参数的抽象功能。
v0.1-alpha1
2018-05-16 10:53 UTC
Requires
- php: ^5.4 | ^7.0
- dhii/expression-interface: ^0.2
- dhii/sql-interface: ^0.1
Requires (Dev)
- codeclimate/php-test-reporter: <=0.3.2
- dhii/php-cs-fixer-config: ^0.1
- dhii/stringable-interface: ^0.1
- phpunit/phpunit: ^4.8
- ptrofimov/xpmock: ^1.1
This package is auto-updated.
Last update: 2024-09-10 23:44:50 UTC
README
使用表达式构建 WP_Query
参数的抽象功能。
详细信息
本软件包提供了从表达式构建 WP_Query
参数的抽象功能,主要用于实现。这些特性旨在相互补充,同时保持对彼此实现细节的无知。大多数,如果不是所有特性,都是为了提供依赖于抽象方法的功能。软件包中的其他特性将为这些抽象方法提供实现,同时也会依赖它们自己的抽象方法。
特性
BuildWpQueryArgsCapableTrait
👁️ 构建 Args
旨在通过尝试将每个表达式项构建为比较、元查询关系条目或分类查询关系条目,为将表达式构建到 WP_Query
参数提供入口功能。
- 必需实现
_buildWpQueryCompare()
- 由BuildWpQueryCompareCapableTrait
实现_buildWpQueryMetaRelation()
- 间接由BuildWpQueryRelationTermCapableTrait
实现_buildWpQueryTaxTelation()
- 间接由BuildWpQueryRelationTermCapableTrait
实现
BuildWpQueryCompareCapableTrait
👁️ 构建 比较
提供构建顶级比较键值对的功能。
- 必需实现
_getWpQueryCompareKey()
_getWpQueryCompareValue()
- 补充
BuildWpQueryRelationCapableTrait
👁️ 构建 关系
提供构建关系数组的功能。
- 必需实现
_getWpQueryRelationOperator()
- 由GetWpQueryRelationOperatorCapableTrait
实现_buildWpQueryRelationTerm()
- 由BuildWpQueryRelationTermCapableTrait
实现
- 补充
BuildWpQueryRelationTermCapableTrait
👁️ 构建 关系术语
提供根据当前关系上下文(即 meta_query
关系或 tax_query
关系)委托构建机制来构建关系数组中术语的功能。
- 必需实现
_buildWpQueryMetaCompare()
- 由BuildWpQueryMetaCompareCapableTrait
实现_buildWpQueryTaxCompare()
- 由BuildWpQueryTaxCompareCapableTrait
实现
- 补充
BuildWpQueryMetaCompareCapableTrait
👁️ 构建 元比较
提供构建元比较数组的功能。
- 必需实现
_getWpQueryMetaCompareKey()
_getWpQueryMetaCompareValue()
_getWpQueryMetaCompareType()
- 由GetWpQueryMetaCompareTypeCapableTrait
实现_getWpQueryMetaCompareOperator()
- 由GetWpQueryMetaCompareOperatorCapableTrait
实现
- 补充
BuildWpQueryTaxCompareCapableTrait
👁️ 构建 分类比较
提供构建分类比较数组的功能。
- 必需实现
_getWpQueryTaxCompareTaxonomy()
_getWpQueryTaxCompareField()
_getWpQueryTaxCompareTerms()
_getWpQueryTaxCompareOperator()
- 由GetWpQueryTaxCompareOperatorCapableTrait
实现
- 补充
GetWpQueryMetaCompareOperatorCapableTrait
👁️ 获取元比较运算符
提供从表达式解析元比较比较类型的函数。
GetWpQueryMetaCompareTypeCapableTrait
👁️ 获取元比较类型
提供从表达式解析元比较值转换类型的函数。
- 必需实现
_getWpQueryMetaCompareValue()
- 补充
GetWpQueryTaxCompareOperatorCapableTrait
👁️ 获取分类比较运算符
提供从表达式解析分类比较运算符的函数。
GetWpQueryRelationOperatorCapableTrait
👁️ 获取关系运算符
提供从表达式解析关系运算符("AND" 或 "OR")的函数。
如果将上述特性全部整合,实现类只需要实现以下内容
_buildWpQueryMetaRelation()
- 建议重定向到buildWpQueryRelation
并使用 "meta" 模式。_buildWpQueryTaxRelation()
- 建议重定向到buildWpQueryRelation
并使用 "tax" 模式。_getWpQueryCompareKey()
- 建议在表达式中搜索VariableTermInterface
或EntityFieldInterface
并检索字段。_getWpQueryCompareValue()
- 建议在表达式中搜索LiteralTermInterface
。_getWpQueryMetaCompareKey()
- 建议在表达式中搜索VariableTermInterface
或EntityFieldInterface
并检索字段。_getWpQueryMetaCompareValue()
- 建议在表达式中搜索LiteralTermInterface
。_getWpQueryTaxCompareTaxonomy()
- 建议在表达式中搜索EntityFieldInterface
并检索实体。_getWpQueryTaxCompareField()
- 建议在表达式中搜索EntityFieldInterface
并检索字段。_getWpQueryTaxCompareTerms()
- 建议在表达式中搜索LiteralTermInterface
。