mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进HasMany关联的getRelationCountQuery方法
This commit is contained in:
@@ -159,11 +159,11 @@ class HasMany extends Relation
|
||||
if ($closure) {
|
||||
call_user_func_array($closure, [ & $this->query]);
|
||||
}
|
||||
|
||||
$localKey = $this->localKey ?: $this->parent->getPk();
|
||||
return $this->query->where([
|
||||
$this->foreignKey => [
|
||||
'exp',
|
||||
'=' . $this->parent->getTable() . '.' . $this->parent->getPk(),
|
||||
'=' . $this->parent->getTable() . '.' . $localKey,
|
||||
],
|
||||
])->fetchSql()->count();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user