mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进模型关联
This commit is contained in:
@@ -84,6 +84,11 @@ class HasMany extends Relation
|
||||
if (!isset($data[$result->$localKey])) {
|
||||
$data[$result->$localKey] = [];
|
||||
}
|
||||
|
||||
foreach ($data[$result->$localKey] as &$relationModel) {
|
||||
$relationModel->setParent($result);
|
||||
}
|
||||
|
||||
$result->setAttr($attr, $this->resultSetBuild($data[$result->$localKey]));
|
||||
}
|
||||
}
|
||||
@@ -108,6 +113,11 @@ class HasMany extends Relation
|
||||
if (!isset($data[$result->$localKey])) {
|
||||
$data[$result->$localKey] = [];
|
||||
}
|
||||
|
||||
foreach ($data[$result->$localKey] as &$relationModel) {
|
||||
$relationModel->setParent($result);
|
||||
}
|
||||
|
||||
$result->setAttr(Loader::parseName($relation), $this->resultSetBuild($data[$result->$localKey]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user