This commit is contained in:
as2252258@163.com
2021-05-02 04:50:45 +08:00
parent 3d8befe6c0
commit d376042361
+3 -3
View File
@@ -342,7 +342,7 @@ class ActiveRecord extends BaseActiveRecord
*/
public function hasOne(string $modelName, $foreignKey, $localKey): HasOne|ActiveQuery
{
if (!$this->has($localKey)) {
if (!isset($this->attributes[$localKey])) {
throw new Exception("Need join table primary key.");
}
@@ -363,7 +363,7 @@ class ActiveRecord extends BaseActiveRecord
*/
public function hasCount($modelName, $foreignKey, $localKey): mixed
{
if (!$this->has($localKey)) {
if (!isset($this->attributes[$localKey])) {
throw new Exception("Need join table primary key.");
}
@@ -384,7 +384,7 @@ class ActiveRecord extends BaseActiveRecord
*/
public function hasMany($modelName, $foreignKey, $localKey): mixed
{
if (!$this->has($localKey)) {
if (!isset($this->attributes[$localKey])) {
throw new Exception("Need join table primary key.");
}