From 02eddb98a2ab459c34f53640d4f51a9870e644b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 29 Sep 2022 18:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Traits/HasBase.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Traits/HasBase.php b/Traits/HasBase.php index bf28bd9..597e326 100644 --- a/Traits/HasBase.php +++ b/Traits/HasBase.php @@ -37,14 +37,14 @@ abstract class HasBase implements \Database\Traits\Relation /** @var Relation $_relation */ protected Relation $_relation; - /** - * HasBase constructor. - * @param ModelInterface $model - * @param $primaryId - * @param $value - * @param Relation $relation - * @throws Exception - */ + /** + * HasBase constructor. + * @param ModelInterface $model + * @param $primaryId + * @param $value + * @param Relation $relation + * @throws Exception + */ public function __construct(mixed $model, $primaryId, $value, Relation $relation) { if (!class_exists($model)) { @@ -60,7 +60,7 @@ abstract class HasBase implements \Database\Traits\Relation $_model = $model::query()->where(['t1.' . $primaryId => $value]); } - $this->_relation = $relation->bindIdentification($model, $_model); + $this->_relation = $relation->bindIdentification($model . '_' . $primaryId . '_' . $value, $_model); $this->model = $model; $this->value = $value;