多态关联支持预载入查询

This commit is contained in:
thinkphp
2016-12-01 17:19:43 +08:00
parent 7ef95130c1
commit b62175c34d
2 changed files with 145 additions and 15 deletions

View File

@@ -1377,7 +1377,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$model = $this->parseModel($model);
$type = $type ?: Loader::parseName($this->name);
if (is_array($morph)) {
list($foreignKey, $morphType) = $morph;
list($morphType, $foreignKey) = $morph;
} else {
$morphType = $morph . '_type';
$foreignKey = $morph . '_id';
@@ -1400,7 +1400,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
}
// 记录当前关联信息
if (is_array($morph)) {
list($foreignKey, $morphType) = $morph;
list($morphType, $foreignKey) = $morph;
} else {
$morphType = $morph . '_type';
$foreignKey = $morph . '_id';