From 0ee05eb1cade69b6b676d3a1c0412f8748cdf090 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 Mar 2017 17:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BPivot=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Pivot.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/library/think/model/Pivot.php b/library/think/model/Pivot.php index 006326dd..06c6b181 100644 --- a/library/think/model/Pivot.php +++ b/library/think/model/Pivot.php @@ -19,25 +19,26 @@ class Pivot extends Model /** @var Model */ public $parent; + protected $autoWriteTimestamp = false; + /** - * 构造函数 + * 架构函数 * @access public - * @param Model $parent - * @param array|object $data 数据 - * @param string $table 中间数据表名 + * @param Model $parent 上级模型 + * @param array|object $data 数据 + * @param string $table 中间数据表名 */ public function __construct(Model $parent, $data = [], $table = '') { - if (is_object($data)) { - $this->data = get_object_vars($data); - } else { - $this->data = $data; - } - $this->parent = $parent; + if (is_null($this->name)) { $this->name = $table; } + + parent::__construct($data); + + $this->class = $this->name; } }