top-think / top-think/think-orm
远程一对一多关联,表名称不全导致查询sql出错
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
if ($this->baseQuery) {
$throughKey = Str::snake(class_basename($this->model)) . "." . $this->throughKey;
}
Str::snake(class_basename($this->model)) 只能得到没有前缀的表名,如果有前缀那不是错了;现在使用远程一对多关联直接报错;没更新之前还是好的,这么改是为什么呢

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report points to src/model/relation/HasManyThrough.php around line 264, where the through key is assembled for a remote one-to-many relation. Start by reproducing the failing query with a configured table prefix and inspect the generated SQL. Done means the relation query works with prefixed table names without SQL errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100