Skip to content

Commit

Permalink
Merge 6e658a1 into 33d437e
Browse files Browse the repository at this point in the history
  • Loading branch information
Moln committed May 24, 2023
2 parents 33d437e + 6e658a1 commit cfe65e0
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['7.4', '8.0', '8.1', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
45 changes: 42 additions & 3 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,45 @@ $app->post(
验证器
--------

- [`DbalRecordExistsFilter`](src/Opis/Filter/DbalRecordExistsFilter.php): 使用 `doctrine/dbal` 验证DB记录是否存在
- [`DoctrineRecordExistsFilter`](src/Opis/Filter/DoctrineRecordExistsFilter.php): 使用 `doctrine/orm` 验证DB记录是否存在
- [`RecordExistsFilter`](src/Opis/Filter/RecordExistsFilter.php): 使用 `PDO` 验证DB记录是否存在
- [`DbalRecordExistsFilter`](src/Opis/Filter/DbalRecordExistsFilter.php): 使用 `doctrine/dbal` 验证DB记录是否存在.
json-schema `$filters`配置:
```json5
{
"$func": "dbal-exists",
"$vars": {
"db": "db", // IoC容器中的 DBAL 对象.
"sql": "select ...", // 自定义 SQL
"table": "foo", // 表名称
"field": "key", // 字段名称
"exists": true // 检查记录存在或不存在. 默认: false
}
}
```
- [`DoctrineRecordExistsFilter`](src/Opis/Filter/DoctrineRecordExistsFilter.php): 使用 `doctrine/orm` 验证DB记录是否存在。
json-schema `$filters`配置:
```json5
{
"$func": "orm-exists",
"$vars": {
"db": "orm.default", // IoC容器中的 ORM 对象.
"dql": "select ...", // 自定义 DQL
"entity": "Foo", // 实体名称
"field": "key", // 字段名称
"exists": true // 检查记录存在或不存在. 默认: false
}
}
```
- [`RecordExistsFilter`](src/Opis/Filter/RecordExistsFilter.php): 使用 `PDO` 验证DB记录是否存在。
json-schema `$filters`配置:
```json5
{
"$func": "db-exists",
"$vars": {
"db": "db", // IoC容器中的 PDO 对象.
"sql": "select ...", // 自定义 SQL
"table": "foo", // 表名称
"field": "key", // 字段名称
"exists": true // 检查记录存在或不存在. 默认: false
}
}
```
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,45 @@ $app->post(
Validators
----------

- [`DbalRecordExistsFilter`](src/Opis/Filter/DbalRecordExistsFilter.php) : Use `doctrine/dbal` to check record exists.
- [`DoctrineRecordExistsFilter`](src/Opis/Filter/DoctrineRecordExistsFilter.php) : Use `doctrine/orm` to check record exists.
- [`RecordExistsFilter`](src/Opis/Filter/RecordExistsFilter.php) : Use `PDO` to check record exists.
- [`DbalRecordExistsFilter`](src/Opis/Filter/DbalRecordExistsFilter.php): Use `doctrine/dbal` to check record exists.
The json-schema `$filters` config:
```json5
{
"$func": "dbal-exists",
"$vars": {
"db": "db", // Get DBAL object by container.
"sql": "select ...", // Set custom SQL
"table": "foo", // Table name
"field": "key", // Field name
"exists": true // Check record exists or not exists. Default: false
}
}
```
- [`DoctrineRecordExistsFilter`](src/Opis/Filter/DoctrineRecordExistsFilter.php): Use `doctrine/orm` to check record exists.
The json-schema `$filters` config:
```json5
{
"$func": "orm-exists",
"$vars": {
"db": "orm.default", // Get ORM object by container.
"dql": "select ...", // Set custom DQL
"entity": "Foo", // Entity name
"field": "key", // Field name
"exists": true // Check record exists or not exists. Default: false
}
}
```
- [`RecordExistsFilter`](src/Opis/Filter/RecordExistsFilter.php): Use `PDO` to check record exists.
The json-schema `$filters` config:
```json5
{
"$func": "db-exists",
"$vars": {
"db": "db", // Get DBAL object by container.
"sql": "select ...", // Set custom SQL
"table": "foo", // Table name
"field": "key", // Field name
"exists": true // Check record exists or not exists. Default: false
}
}
```

0 comments on commit cfe65e0

Please sign in to comment.