mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进一对多with关联查询的field支持
This commit is contained in:
@@ -77,7 +77,7 @@ class HasMany extends Relation
|
||||
}
|
||||
|
||||
if (!empty($range)) {
|
||||
$data = $this->eagerlyOneToMany(new $this->model, [
|
||||
$data = $this->eagerlyOneToMany($this->query, [
|
||||
$this->foreignKey => [
|
||||
'in',
|
||||
$range,
|
||||
@@ -114,7 +114,7 @@ class HasMany extends Relation
|
||||
$localKey = $this->localKey;
|
||||
|
||||
if (isset($result->$localKey)) {
|
||||
$data = $this->eagerlyOneToMany(new $this->model, [$this->foreignKey => $result->$localKey], $relation, $subRelation, $closure);
|
||||
$data = $this->eagerlyOneToMany($this->query, [$this->foreignKey => $result->$localKey], $relation, $subRelation, $closure);
|
||||
// 关联数据封装
|
||||
if (!isset($data[$result->$localKey])) {
|
||||
$data[$result->$localKey] = [];
|
||||
|
||||
Reference in New Issue
Block a user