From 64c51cdde67c85c159b8befc253ab7c366f90cf9 Mon Sep 17 00:00:00 2001 From: yinggaozhen Date: Wed, 2 Aug 2017 21:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9connecttion=E5=92=8CbelongsTo?= =?UTF-8?q?=E8=8B=A5=E5=B9=B2=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Connection.php | 11 ++++++----- library/think/db/Query.php | 3 ++- library/think/model/relation/BelongsTo.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index dee87494..24fe07f4 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -338,8 +338,8 @@ abstract class Connection * @param bool $master 是否在主服务器读操作 * @param bool $pdo 是否返回PDO对象 * @return mixed - * @throws BindParamException * @throws PDOException + * @throws \Exception */ public function query($sql, $bind = [], $master = false, $pdo = false) { @@ -400,8 +400,8 @@ abstract class Connection * @param string $sql sql指令 * @param array $bind 参数绑定 * @return int - * @throws BindParamException * @throws PDOException + * @throws \Exception */ public function execute($sql, $bind = []) { @@ -552,7 +552,7 @@ abstract class Connection * @access protected * @param bool $pdo 是否返回PDOStatement * @param bool $procedure 是否存储过程 - * @return array + * @return PDOStatement|array */ protected function getResult($pdo = false, $procedure = false) { @@ -618,7 +618,8 @@ abstract class Connection /** * 启动事务 * @access public - * @return void + * @return bool|mixed + * @throws \Exception */ public function startTrans() { @@ -782,7 +783,7 @@ abstract class Connection /** * 是否断线 * @access protected - * @param \PDOException $e 异常对象 + * @param \PDOException|\Exception $e 异常对象 * @return bool */ protected function isBreak($e) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index f18f38bc..91499647 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -2336,7 +2336,7 @@ class Query $modelName = $this->model; if (count($resultSet) > 0) { foreach ($resultSet as $key => $result) { - /** @var Model $result */ + /** @var Model $model */ $model = new $modelName($result); $model->isUpdate(true); @@ -2392,6 +2392,7 @@ class Query * @param mixed $value 缓存数据 * @param array $options 缓存参数 * @param array $bind 绑定参数 + * @return string */ protected function getCacheKey($value, $options, $bind = []) { diff --git a/library/think/model/relation/BelongsTo.php b/library/think/model/relation/BelongsTo.php index a32cc124..dfd74a59 100644 --- a/library/think/model/relation/BelongsTo.php +++ b/library/think/model/relation/BelongsTo.php @@ -11,6 +11,7 @@ namespace think\model\relation; +use think\db\Query; use think\Loader; use think\Model; @@ -68,7 +69,6 @@ class BelongsTo extends OneToOne * @param string $operator 比较操作符 * @param integer $count 个数 * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 * @return Query */ public function has($operator = '>=', $count = 1, $id = '*')