Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Aug 5, 2023
1 parent 0df2a80 commit dfa801a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 8 additions & 0 deletions doc/base/version/2.0-2.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ v2.0 是一个非常成功的 LTS 版本,进行了底层重构,增加了强

## 新功能

### v2.1.51

**发布日期:** `2023-08-05`

* 模型关联支持跨数据库和跨连接池场景,模型关联注解新增 `poolName` 参数

* 模型 `@JsonDecode` 注解新增 `arrayWrap` 参数 ([#569](https://github.com/imiphp/imi/pull/569))

### v2.1.49

**发布日期:** `2023-07-10`
Expand Down
8 changes: 5 additions & 3 deletions doc/components/orm/RDModel/definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ abstract class ArticleBase extends Model

写在属性上,可以覆盖写在类上的注解。

完整参数:`@JsonDecode(associative=true, depth=512, flags=0, wrap=\Imi\Util\LazyArrayObject::class)`
完整参数:`@JsonDecode(associative=true, depth=512, flags=0, wrap=\Imi\Util\LazyArrayObject::class, arrayWrap=false)`

> `$wrap` 外其它参数含义同 `json_decode()`
> `associative``depth``flags` 参数含义同 `json_decode()`
**$wrap 参数说明:**
**参数说明:**

`$wrap` 反序列化数据的包装,如果是对象或者数组时有效。支持类名、函数名。设为空字符串时,反序列化为数组。

`$arrayWrap` 设为 `true` 时,属性值类型为数组,使用 `wrap` 对数组成员进行包装。

类名:

```php
Expand Down
12 changes: 12 additions & 0 deletions doc/components/orm/relation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@

> 仅查询有效,非软删除模型请勿设置为 `true`
描述的字段模型,使用父模型连接池名称(默认):

`@OneToOne(model="模型类名", poolName=\Imi\Model\Enum\RelationPoolName::PARENT)`

描述的字段模型,使用被关联的模型本身的连接池配置:

`@OneToOne(model="模型类名", poolName=\Imi\Model\Enum\RelationPoolName::RELATION)`

描述的字段模型,指定连接池名字:

`@OneToOne(model="模型类名", poolName="连接池名")`

### @OneToMany

一对多关系声明
Expand Down

0 comments on commit dfa801a

Please sign in to comment.