From da2421113bf861915383f97f53ff0889697232b6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 18 Jan 2017 22:01:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=90=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index dc745b7f..d671028d 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1415,18 +1415,18 @@ abstract class Model implements \JsonSerializable, \ArrayAccess * @access public * @param string $model 模型名 * @param string $foreignKey 关联外键 - * @param string $otherKey 关联主键 + * @param string $localKey 关联主键 * @param array $alias 别名定义(已经废弃) * @param string $joinType JOIN类型 * @return BelongsTo */ - public function belongsTo($model, $foreignKey = '', $otherKey = '', $alias = [], $joinType = 'INNER') + public function belongsTo($model, $foreignKey = '', $localKey = '', $alias = [], $joinType = 'INNER') { // 记录当前关联信息 $model = $this->parseModel($model); $foreignKey = $foreignKey ?: $this->getForeignKey($model); - $otherKey = $otherKey ?: (new $model)->getPk(); - return new BelongsTo($this, $model, $foreignKey, $otherKey, $joinType); + $localKey = $localKey ?: (new $model)->getPk(); + return new BelongsTo($this, $model, $foreignKey, $localKey, $joinType); } /**