From a538c3983723b48296ee24863ace22c366e6a704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 9 Nov 2021 14:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model.php b/src/Model.php index cf66b9a..04e7287 100644 --- a/src/Model.php +++ b/src/Model.php @@ -334,7 +334,7 @@ class Model extends Base\Model */ public function hasOne(string $modelName, $foreignKey, $localKey): HasOne|ActiveQuery { - if (($value = $this->getAttribute($localKey)) === null) { + if (($value = $this->{$localKey}) === null) { throw new Exception("Need join table primary key."); } @@ -353,7 +353,7 @@ class Model extends Base\Model */ public function hasCount($modelName, $foreignKey, $localKey): ActiveQuery|HasCount { - if (($value = $this->getAttribute($localKey)) === null) { + if (($value = $this->{$localKey}) === null) { throw new Exception("Need join table primary key."); } @@ -372,7 +372,7 @@ class Model extends Base\Model */ public function hasMany($modelName, $foreignKey, $localKey): ActiveQuery|HasMany { - if (($value = $this->getAttribute($localKey)) === null) { + if (($value = $this->{$localKey}) === null) { throw new Exception("Need join table primary key."); } @@ -390,7 +390,7 @@ class Model extends Base\Model */ public function hasIn($modelName, $foreignKey, $localKey): ActiveQuery|HasMany { - if (($value = $this->getAttribute($localKey)) === null) { + if (($value = $this->{$localKey}) === null) { throw new Exception("Need join table primary key."); }