mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 16:12:49 +08:00
修正BelongsTo关联
This commit is contained in:
@@ -85,10 +85,10 @@ class BelongsTo extends OneToOne
|
|||||||
// 关联数据封装
|
// 关联数据封装
|
||||||
foreach ($resultSet as $result) {
|
foreach ($resultSet as $result) {
|
||||||
// 关联模型
|
// 关联模型
|
||||||
if (!isset($data[$result->$localKey])) {
|
if (!isset($data[$result->$foreignKey])) {
|
||||||
$relationModel = null;
|
$relationModel = null;
|
||||||
} else {
|
} else {
|
||||||
$relationModel = $data[$result->$localKey];
|
$relationModel = $data[$result->$foreignKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($relationModel && !empty($this->bindAttr)) {
|
if ($relationModel && !empty($this->bindAttr)) {
|
||||||
@@ -116,10 +116,10 @@ class BelongsTo extends OneToOne
|
|||||||
$foreignKey = $this->foreignKey;
|
$foreignKey = $this->foreignKey;
|
||||||
$data = $this->eagerlyWhere($this, [$localKey => $result->$foreignKey], $localKey, $relation, $subRelation, $closure);
|
$data = $this->eagerlyWhere($this, [$localKey => $result->$foreignKey], $localKey, $relation, $subRelation, $closure);
|
||||||
// 关联模型
|
// 关联模型
|
||||||
if (!isset($data[$result->$localKey])) {
|
if (!isset($data[$result->$foreignKey])) {
|
||||||
$relationModel = null;
|
$relationModel = null;
|
||||||
} else {
|
} else {
|
||||||
$relationModel = $data[$result->$localKey];
|
$relationModel = $data[$result->$foreignKey];
|
||||||
}
|
}
|
||||||
if ($relationModel && !empty($this->bindAttr)) {
|
if ($relationModel && !empty($this->bindAttr)) {
|
||||||
// 绑定关联属性
|
// 绑定关联属性
|
||||||
|
|||||||
Reference in New Issue
Block a user