代码改进

This commit is contained in:
thinkphp
2017-06-23 14:48:38 +08:00
parent 915c46c4bd
commit 946845e0f4

View File

@@ -105,9 +105,8 @@ class BelongsToMany extends Relation
{
$foreignKey = $this->foreignKey;
$localKey = $this->localKey;
$middle = $this->middle;
$pk = $this->parent->getPk();
// 关联查询
$pk = $this->parent->getPk();
$condition['pivot.' . $localKey] = $this->parent->$pk;
return $this->belongsToManyQuery($foreignKey, $localKey, $condition);
}