From d30316efda16a0a4586b8e638931de7fbaa05404 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 19 Jun 2017 15:27:55 +0800 Subject: [PATCH] =?UTF-8?q?model=E7=B1=BB=E5=A2=9E=E5=8A=A0removeRelation?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/think/Model.php b/library/think/Model.php index 6fc8cabe..9394421a 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -838,6 +838,17 @@ abstract class Model implements \JsonSerializable, \ArrayAccess return json_encode($this->toArray(), $options); } + /** + * 移除当前模型的关联属性 + * @access public + * @return $this + */ + public function removeRelation() + { + $this->relation = []; + return $this; + } + /** * 转换当前模型数据集为数据集对象 * @access public