This commit is contained in:
thinkphp
2016-12-28 14:58:43 +08:00
parent 28844c12b0
commit 293dce8639
3 changed files with 10 additions and 7 deletions

View File

@@ -439,7 +439,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$value = $this->readTransform($value, $this->type[$name]);
} elseif ($notFound) {
$method = Loader::parseName($name, 1, false);
if (method_exists($this, $method) && $this->$method()->removeOption() instanceof Relation) {
if (method_exists($this, $method) && $this->$method() instanceof Relation) {
// 清空之前的查询参数
$this->$method()->removeOption();
// 不存在该字段 获取关联数据
$value = $this->$method()->getRelation();
// 保存关联对象值