mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-04 14:22:48 +08:00
改进关联属性
This commit is contained in:
@@ -79,13 +79,14 @@ class HasMany extends Relation
|
||||
$range,
|
||||
],
|
||||
], $relation, $subRelation, $closure);
|
||||
|
||||
// 关联属性名
|
||||
$attr = Loader::parseName($relation);
|
||||
// 关联数据封装
|
||||
foreach ($resultSet as $result) {
|
||||
if (!isset($data[$result->$localKey])) {
|
||||
$data[$result->$localKey] = [];
|
||||
}
|
||||
$result->setAttr(Loader::parseName($relation), $this->resultSetBuild($data[$result->$localKey], $class));
|
||||
$result->setAttr($attr, $this->resultSetBuild($data[$result->$localKey], $class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user