From 185961821a83faf979ebfdbc0390cb9c3188a96e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 7 Sep 2016 11:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRelation=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Relation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index 0a18d1f1..0af4d3b8 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -107,7 +107,7 @@ class Relation $result = $this->belongsToManyQuery($relation, $this->middle, $foreignKey, $localKey, $condition)->select(); foreach ($result as $set) { $pivot = []; - foreach ($set->toArray() as $key => $val) { + foreach ($set->getData() as $key => $val) { if (strpos($key, '__')) { list($name, $attr) = explode('__', $key, 2); if ('pivot' == $name) { @@ -308,7 +308,7 @@ class Relation protected function match($model, $relation, &$result) { // 重新组装模型数据 - foreach ($result->toArray() as $key => $val) { + foreach ($result->getData() as $key => $val) { if (strpos($key, '__')) { list($name, $attr) = explode('__', $key, 2); if ($name == $relation) { @@ -369,7 +369,7 @@ class Relation $data = []; foreach ($list as $set) { $pivot = []; - foreach ($set->toArray() as $key => $val) { + foreach ($set->getData() as $key => $val) { if (strpos($key, '__')) { list($name, $attr) = explode('__', $key, 2); if ('pivot' == $name) {