Skip to content

Commit 6aa08fd

Browse files
committed
修正
1 parent 1171a6e commit 6aa08fd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/model/View.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ public function __construct(?Model $model = null, bool $with = false)
4040

4141
// 初始化模型
4242
if (!$this->isEmpty()) {
43-
$this->initData($with);
43+
$this->initData(!$with);
4444
}
4545
}
4646

4747
/**
4848
* 初始化实体数据属性(如果存在关联查询则会延迟执行).
4949
*
50-
* @param bool $with 是否处理关联数据
50+
* @param bool $relation 是否处理关联数据
5151
* @return void
5252
*/
53-
public function initData(bool $with = true)
53+
public function initData(bool $relation = true)
5454
{
5555
// 获取实体属性
5656
$properties = $this->getEntityProperties();
5757
$data = $this->model()->getData();
5858
foreach ($properties as $key => $field) {
59-
if (!$with) {
59+
if (!$relation) {
6060
// 确保存在基础模型数据
61-
if (isset($data[$field])) {
61+
if (isset($data[$field])) {
6262
$this->$field = $data[$field];
6363
}
6464
continue;

0 commit comments

Comments
 (0)